[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Does anyone actually use OOP unironically? Why would I ever

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 83
Thread images: 6

File: java.jpg (36KB, 651x400px) Image search: [Google]
java.jpg
36KB, 651x400px
Does anyone actually use OOP unironically?

Why would I ever want objects for storing data when I can just create a multidimensional array?

>abstraction
>good
Thank God C still exists
>>
>>52649444
>Why would I ever want objects for storing data when I can just create a multidimensional array?

Not using pointers + offsets
>>
>>52649444
You can do OOP and not use classes for every thing! You don't have to create a class that extends array or object, come on! Don't be a dumbass, don't go too far into the meme
>>
>>52649444
Multidimensional why?
Why not array of structs
>>
>>52649444
You could use an object that already does things such as expand the array when needed, and abstracts that process away. Allows you to build things more quickly and easily.
>>
this thread is making me kek
keep shilling dumbass anti-OOP
>>
>>52649444
reusable abstracted code
>>
>>52649444
Yes.
>>
OOP was a stupid fad back in the 80s. I am astounded that anyone took it seriously and horrified that it has gone on so long.
>>
>>52649444
I wasn't going to respond to your obvious bait, but then I saw your triples and figured might as well.

I used to hate OOP because of people who used it badly (like the professors who taught me it.) But like any programming paradigm, the truth is it has its good parts and bad parts. Inheritance is one of those parts to stay away from in my opinion.

One of the nice parts is that it helps you logically organize your code. It also lets you make data types and attach functions to them and reuse those functions logically for other data types.

If you're not just baiting, you're doing yourself a major disservice by dismissing an entire paradigm. Even if it sucks overall, there's still a lot you can learn from it.
>>
OOP is good for business settings so people don't have to read through miles of someone else's thoughts. They can just get chunks of code as classes and literally fit them together like a child would fit Legos together. They can also break projects apart into pieces without looking too deep into the code to better understand how it all fits together. It's useful that way.

However! It's a cluster fuck to do when you're working on your own and completely unnecessary. Making 20+ java files linked up together to run a simple program is asinine.
>>
cos you are a retard, modularity is the best weapon for abstraction and complexity control, concretization is human but abstraction and modularity are divine
>>
It can make the world easier to describe.
A simple example is data structures.

Your example was a two dimensional array.

Say you want to make calculations with a matrix.

Having matrix class could be benificial.
Eg. you have the data stored in a two dimensional array.
Then you would like to make functions like matrix multiplications, determinant, inverse, transpose etc.

In c++, you can overload functions such that mat_a * mat_b becomes the matrix multiplication you wanted.

This is useful abstractions as the people who work with the code knows what multiplications does and all they have to do is multiply two matrices.

Now this is also useful when you have to represent other stuff like nodes in a graph or make abstractions in a large application.
>>
>>52649962
>Making 20+ java files linked up together to run a simple program is asinine.

At an internship one of the programmers at the company did that. Some kind of parser program he wrote more or less on his own.

When he showed me the program, it took him about 10+ hops to get to a part where actually reads in a document. He got lost in his unnecessary layers upon layers of abstraction.

Shit was hilarious and sad at the same time.
>>
>>52649444
>storing data
that's not what OOP is for - structs can do that in C.

it's a little over rated but they're for *predictably* inheriting attributes and operations.

like... if you're making a game. anything subclassing type Bird can fly() and poop() so when you implement Duck all you need to do is implement quack() and when you implement Chicken all you need to do is implement cluck().
>>
>>52649984
but... OP thinks it will be easier to do
multiply_mats(array1, 4, 4, mat2, 4, 1)
>>
>>52650106
okay...
Even opencv does a better job than that.
>>
>>52649962
This. OOP allows you to just import classes and call on a few public methods, the abstraction makes it easy to fit into other projects. This means that multiple people can write their own classes and fit them together into some larger program, without having to understand the details of their implementations. And if everything is properly organized/encapsulated, you don't have to worry about your code ever fucking with code someone else wrote.
>>
>>52650623
Ah, the beauty of it.
>>
>>52649444
I'm currently studying software engineering(full time) and the only language offered is Java in OOP. Not kidding, this other location of the same school instead offers C-Sharp, should I switch from location? C-Sharp is almost just as shitty
>>
>>52649962
>>52650623
That doesn't really work in practice. There are too many cross-cutting concerns like logging, authorization or error handling that create dependencies to the program the class resides in.

Additionally, there can be many traps like hidden dependency chains inside of classes (class A calls class B, which in turn needs class C), so in the end you always pull in big parts of the application.

If you want to make a class portable across application you usually always end up creating a whole library anyways.
>>
Lol, OP never went past fizzbuzz.

When you have a let's say betting application with 20 different view, and a viewmodel for each of it, you'll be running with arms wide open to OOP.

For example, each ViewModel implements ViewModelBase that has a virtual method called Initialize() that sets back the state of it to the one it was when you started the application.

So instead of doing:
CientAreaVM.Initialize();
BettingOverviewVM.Initialize();
. . .
all 20+ ViewModels
. . .

You register them into a IoC container that keeps track of all ViewModels that inherit ViewModelBase, and since they all override Initialize() you have a one liner when you want to reset the application:

this.EachViewModel(viewModel => viewModel.Initialize());

And that's just one tiny example where, if you abstract properly, with 2-3 extra lines of code, or one Interface/Base class, you can save tons of boilerplate code.
>>
>>52649444
>i am 12 years old and le hardcore hacker xD
>java is too easy, for noobs. real hackers only code in C xD
>>
>>52649444
>tfw I apply OOP and other design patterns in all my python code
>tfw I do TDD
you memers are really missing out
>>
>>52649951
Inheritance is clean from a design standpoint. For instance, I'm writing a football game. There are plays that you can call, each of which behaves differently but still shares common functionality. I can write common functionality once in the super class and write more specific implementation in subclasses. When these classes get used I can just keep a generic Play object and rely on java to call the appropriate subclass methods at runtime.
>>
>>52649444
>Thank God C

you mean thank Dennis Ritchie right?
>>
>>52651052
Except instead of running those plays on a real field, you have the professionals do them on the sidelines, and just have some fans watch them and try to replicate it in the field.
>>
If you don't understand the benefits of OOP (and Java, for that matter), you have a lot to learn about programming.
>>
>>52649444
>Java
Hmmm. How about you try out something with a real OOP concept like Smalltalk? Java has some OOP features, but the features in Java are not the only way to do OOP.
>>
>>52649444
How would you store an int, a float and a string in a multiple dimensioned array?

>inb4 just use three different arrays

Lrn2 composite types
>>
>>52651607
void pointer
>>
>>52651607
Why would you? Just store everything as a string and convert later if you need to do calculations
>>
>>52649444
I use functional javascript mate. Too bad the tech world is taking forever to catch up
>>
>>52651716
>do string conversions everywhere

>>52651693
>don't use types at all

The mental gymnastics you people will do to avoid "objects" is outright astonishing
>>
>>52651607
>>52651760
How new are you? You seem like those CS kiddies trying to over complicate everything
>>
File: lol.jpg (9KB, 289x175px) Image search: [Google]
lol.jpg
9KB, 289x175px
>>52649812
>oop
>abstract
>>
>>52649444
even the simplest java programs are bloated as fzck and take "ages" (not really but compared to C applications) to load!
Then print aome stuff and exit
Actual 40 lines mini "project" in Netbeans (80k of storage, 2MB ram use, for printing binary numbers converted to dec. numbers, fuck java!)
>>
>>52651817
>composite types = over complicating
>keeping track of memory alignment manually, pointer arithmetics and casts everywhere = simple
>doing expensive conversions from and to string representations = simple

I hope I'm being trolled.
>>
>>52651607
Using a struct with 3 members (they could be pointers too). The space requirements will be larger, but well yeah. It will also need lot more memory access, due to dereferencing all those pointers.
Void pointer array is a solution too.
You could also just implement your own objects. Take a look at some time how inheritance (especially shit which has the virtual keyword in it) is done in C++ under the hood. It's just nice that the compiler and the language abstracts it away, but it's not a clean solution in the way you might think it is.
>>
>>52651826
same code in C loads in microseconds + compiles in miliseconds + takes less than a tenth of ram!
>>
>>52651851
>Using a struct with 3 members (they could be pointers too)
Struct instances are objects.

/Thread
>>
>>52649444
What about microcontrollers?
They do not use java, they use c!
C!
>>
OOP's main strength lies in generics, and abstract interfaces. These concepts can be implemented in a language like C, but it requires more work on the programmer's side. A C-like language with a standard multithreading library, and a small subset of C++'s features would be a really good systems programming l
language imo
>>
>>52651864
Depends on the language C++ terms something like that, but there's a difference between a POD C struct and between an object defined using the struct keyword in C++. Struct is simply an aggregated type.
>Struct instances are objects.
That's like saying ints are objects in the C world, where they're not.
>>
>>52651855
Humans vs machines, anon.

imperative is far better for machines because of how they work, while oop is better for humans because of how we work

just like you're not going to write a script in c++, you'll just use python or bash, you should use the adequate tool to the task
imperative languages are better for performance, OOP are better for complex programs that have to be mantained by different people
>>
File: 36743.gif (855KB, 500x281px) Image search: [Google]
36743.gif
855KB, 500x281px
>>52651917
>generics are OOP
>>
>>52651917
interfaces
needlessly moving one problem (types) somewhere else.
Creating useless multiple functions that jusr call other functions and so on.
Either my teacher taught nonsens, rhe examples are srupid or I'm too dumb to get the advantage of interfaces.
>>
>>52651924
fuck humans

what about good documentation?
Also, pointers?
Function pointers?
>>
>>52651956
interfaces are good for subtyping
sometimes you want a hierarchy of types
>>
>>52651970
Yes, but as I learned it, it's effectively just a THING between 2 classes, that does not help getting the hierarchy right.
So it might be the example, why I don't get how interfaces help
>>
>>52651991
shared behaviour
types that enclose other types
etc
>>
>>52651927
OOP languages had generics before statically typed functional languages existed.
>>
>>52651923
But they are. In the standard it's literally called objects.
>>
>>52652014
Parametric polymorphism was first introduced to programming languages in ML in 1975.[3]
>>
>>52651923
>Struct is simply an aggregated type.
No shit Sherlock. That's what I said all along. See

>>52651607
>>
>>52649444
>Does anyone actually use OOP unironically?
The ones who have jobs.
>>
>>52651966
> fuck humans
kek
>>
>>52652077
Web developers don't use oop
>>
>>52652105
Those who have a job do
>>
>>52651924
Some other guy, but I always found imperative + "functional-like" stuff easier + a bit of OOP better and that's how I write some code. I never liked too much OOP or it's mindless using.
>>52651956
Imagine a game where you have different creatures, but want common commands to them to follow. Like go there, attack that, how much hp do you have? how much armor do you have? where are you? is x hostile to you? equip that if you can! use that item! what's in your inventory? etc....
Now you define these as functions of the interface and all creatures capable of doing all these functions will implement this interface. You can also allow implementing the interface when it can't do it so it will give you an error (like an animal can't equip a longbow) through a well defined interface. Yet the class of these creatures are really different. For example one to perform proper animations and behavior might inherit from the FourLeggedAnimal class or the PrimitiveCreature class and another inherits from the UndeadNPC class which has a vastly different AI and capable of equipping and using items. (Inheritance is not always the best way to do things, composition is sometimes a lot better, but it makes a good example for interfaces, even composition does) The thing is you don't need to know the actual class of the object. As such you can store them in the same array/container/whatever. When you need to know it's actual type you could have your interface could have a function where each object gives back it's actual type then you know how you can refer to it properly.
When you do composition you have classes do specific functions. When a creature wants that function it will have that class as it's member. So in that case you will use interfaces to get information about whether that creatures has for example an instance of MovementModelFourLegged in it. Then you get that subsystem and give it specific commands which it will apply to what it's part of.
>>
>>52652067
Shit.
I misread your argument with the
>Lrn2 composite types
I read it as inb4.
Was I arguing with you all along? Then I guess it was pointless. My mistake, m8.
>>
>>52652127
Dynamic typing isn't OOP, it's dictionary oriented programming
>>
>>52652155
Holy shit. That text looks l wrote it while I'm drunk. I must seriously wake up, shouldn't have overslept.
>>
>>52652208
Get a job, turbonerd.
>>
>>52652195
We all do that sometimes. No worries mate.

>>52652208
Not talking about type system. Talking about code structure and design. I worked as a Web developer. We used a MVC pattern using objects.
>>
>>52652230
>>52652250

No, you used MVC pattern using a dictionary
>>
>>52652105
That's the only kind of Java that matters
>>
>>52652050
Wikipedia also said closures were introduced by Scheme. It gets a lot of things wrong.
>>
File: okay.png (9KB, 350x350px) Image search: [Google]
okay.png
9KB, 350x350px
>>52649444
Nice trips, but even you know C fags don't store data in multidimensional arrays but in objects called structs and then make functions prefixed by the name of the object they manipulate on.
FAGGOT*  OP = malloc(sizeof(FAGGOT));
faggot_set_faggotry(OP, 100);
faggot_be_a_faggot(OP);
int x = faggot_get_faggotry(OP);
/* notice how all functions start with faggot_ and pass OP as first arg? */


OOP just refines this abstraction by letting objects contain methods and letting objects contain methods and letting them clearly define what they manipulate and what they do.
FAGGOT* OP = new FAGGOT;
OP->set_faggotry(100);
OP->be_a_faggot();
int x = OP->get_faggotry();
/* We know OP is a FAGGOT and we know what he is able of. */


The abstraction is pretty much the same, It's just that C fags have to struggle doing simple tasks that OOP languages do easy like inheritance, polymorphism, encapsulation, etc.
>>
I use OOP for abstraction though
>oh no, I need to handle [thing] differently for Linux, OSX, and Windows
Plus OOP is cleaner for entities.
I use structs for vectors and other POD
>>
>>52652458
> using "TYPE* name" declarations instead of "TYPE *name"
shiggydiggy

C's pointer/array declaration syntax (mimicking most common accessors, splitting them from the base type in multiple declaration statements, etc.) is retarded and confuses a lot of new programmers, but it's even worse to misrepresent what the language is doing.

> int* x = 0, y = 1; // thanks, Ritchie, for making this possible
>>
>>52652585
I prefer
type* x

It can be typedef'd
It says its a pointer to type better than
type x, *y


Besides,
type x, y, z
is disgusting; what if x, y, or z need to be different types
>>
>>52649782
OP hasn't learnt about structs yet most likely
>>
>>52652585
>he uses "TYPE *name"
Raging C fag detected.

It's always
type identifier;
and in this case it's pointer type regardless that C syntax doesn't really see it like that.

But if you're concerned about new programmers though just teach them to always do this:
int* x = 0;
int y = 1;
>>
>>52649444
Yes

https://github.com/L-M-V-A/JDUA/blob/master/README.md
>>
>>52651716
This post gave me ass cancer.
>>
>>52652458
this
>>
File: handsome-indian-man23804674.jpg (48KB, 301x450px) Image search: [Google]
handsome-indian-man23804674.jpg
48KB, 301x450px
>>52652458
>>52652765
>defending OOP practices this hard
>calling programmers "C fags"
>2016
>being this designated

please stop talking about C you clearly know nothing about and go back to Java you curry eating street shitter.
>>
>>52652765
>It's always
>type identifier;
>and in this case it's pointer type regardless that C syntax doesn't really see it like that.

In C, being a pointer/array is explicitly part of the identifier, even if it makes fuck all sense.

the only thing worse than being retarded is being retarded and trying to hide it.
>>
>>52649962

Right there.

Business layers build with oop are useful as fuck in building software systems.
>>
>>52649444
> i'm too dumb to understand the standard paradigms of OOP
> OOP is shit

Well yes, you don't need classes and OOP for you fizzbuzz in your mom's basement, you fuckin fat neckbeard.
>>
>>52653847
this
/thread
>>
>>52650786
You counter that by not making classes dependent on other classes. Make each one self contained and able to interact with another class, but not dependent on it. If dependency on any outside class is a must you damn well better outline it and put it in red ink at the top of your logs you share with teammates.
Thread posts: 83
Thread images: 6


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.