[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]

OOP is a sham

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: 44
Thread images: 8

File: 1492741824627.jpg (564KB, 1020x1486px) Image search: [Google]
1492741824627.jpg
564KB, 1020x1486px
>have known python for 7 years now
>done all sorts of fun shit with it
>today is the first day I built something that needed classes
>it didn't even need classes they just allowed easy organization

is OOP literally a joke? Everything I accomplished with classes I could have done literally by just thinking a bit more carefully about how I wrote everything. Yea thats more effort, but more effort is required if you wanna make something good
>>
File: 1492641701544.png (5KB, 269x277px) Image search: [Google]
1492641701544.png
5KB, 269x277px
I'm rewriting it without classes right now and its taking longer to write but I feel much better about it.

using classes feels dirty
>>
what even is this thread? Yeah once you get out of making tool programs and scripts, objects are pretty useful for organizing your programs idiot.

you were already using python objects anyways
>>
>>60028987
dur dur durrrr

yea but its a matter of how you write your code. I disagree. I've made an entire segment of gimp without a single class, just functions
>>
>>60029003
If this is true, it would partially explain why gimp is so shit.

>>60028942
You are an idiot.
>>
>>60028942

There was potential here, but the fucking faggot who made it is shit at old english.
>>
>>60028942
How mantainable is your code?
How reusable is your code?
How easy would it be for another programmer to read it and start writing on it?

OOP is mainly for business, for having a good standard to follow so that you have a common ground with fellow programmers.
>>
>>60029003
and yet gimp has a lot of objects, gtk has a lot of objects, the linux kernel has a lot of objects

objects are fine and good for organizing big project, you could argue you don't have to write big projects without objects, but you'd have to do whole lot of arguing.. But it's probably unneeded for toys and small projects though.
>>
>>60028942
What newspaper?
>>
You're a retard.
>>
File: widlar.jpg (1MB, 1024x1520px) Image search: [Google]
widlar.jpg
1MB, 1024x1520px
>>60028942

OOP is an unfortunate symptom of atavistic visual cortex reliance

the graph and set theoretic origins of category oriented functional programming ain't much better
>>
>>60028942
DOD > OOP
>>
>>60028942
It is. The most retarded part is that sometimes it is used to organize your code into classes, logically, but then the class will have only one fucking instance.
>>
>>60028942
>out of a sudden

How can someone even make this mistake? 'Out of' doesn't sound anything like 'all of'.
>>
>>60028942
OOP is good for certain problems and in certain contexts. It's just an organizational thing. The problem is that Pajeet abuses it and over-complicates everything.

I remember taking a numerical computation class from the mathematics department, but a bunch of CS majors were in the class. One day, the professor basically had to yell STOP TRYING TO ABSTRACT EVERYTHING INTO A CLASS. Some problems are procedural.
>>
>>60028942
>t. Script Kiddie
Your "fun shit" doesn't count as real. That's why you haven't needed OOP.
>>
>>60028942
Just renaming functions does it for me.
>nope they arent functions
>they are called methods
>let me elaborate in retarded jingo
a method is a subroutine (or procedure or function) associated with a class. With respect to Object Oriented programming the term "Method" is used, not functions. When a function is a part of a class, it's called a method.

wot
>>
File: kcSVevM.png (259KB, 720x400px) Image search: [Google]
kcSVevM.png
259KB, 720x400px
>>60028942
>you can do things either way
>"my way is clearly better your are all faggots"
>>
OOP makes a lot more sense if you program a bit in Smalltalk yet you will also see the flaws in other languages trying to do OOP
>>
>>60028942
>used python for 7 years
>still does not know when to use classes
I learned the usefulness of it within the first week of learning programming, and it's not to be more organized
>>
>>60029796

>classes containing nought but static methods
>>
>>60031717

A method is just a function with an implicit "this" parameter.
object.method(params...) is the same as class::function(object, params...) for non-virtual methods.
>>
>>60031830
I understand it. That's why I think it's stupid. It's just a function in a class.

There was no need to abstract a different meaning. If the function is in a special wrapper (a class), there is already an understanding that the wrapper may block/allow access to only some functions.
>could do the same if the wrapper was a file via relevant naming convention
>this
>being the 'naming convention' in classes

Calling it a method rather than just calling it a function in a class, seems stupid to me. Taking something and giving it an abstract meaning just to realign the focus of its use is pretty idiotic.
>it's like calling mp3s, ipod music files
>>
>>60028942
never worked a day in his life
>>
>>60031794
This gets on my nerves so much. Why not just use a submodule?
>>
File: 1359094633129.gif (500KB, 500x375px) Image search: [Google]
1359094633129.gif
500KB, 500x375px
Okay you made me reply.

I'm an automotive software engineer essentially meaning I write C code for cars. We use C# to automate scripts with external power supplies or measurement tools.

Thanks to OOP we can have inheritance meaning that when I write C# code I can use classes to make my life easier.

I.e.

io.powerSupply.Xantrax.SetVoltage(14);

Or

io.measurment.futekTorque.GetTorque();

see how easy that is? It's logically name interfaces that have constructors that do something every call.

It is insanely useful and makes organizing a shitload of driver C# much more efficient.

SO long story short fuck you OP.
>>
>>60031788
This.

The original concept of OOP was closer to what we now call the "actor model" (think Erlang and shit)
>>
i call functions with structures as parameters, who needs objects h-haha!
>>
File: bait-18.gif (68KB, 300x153px) Image search: [Google]
bait-18.gif
68KB, 300x153px
>>60032556
This has to be bait. You're not even using any meaningful OOP in your so-called examples.
>>
File: oop-1.png (152KB, 1948x858px) Image search: [Google]
oop-1.png
152KB, 1948x858px
>>60028942
Pic somewhat related. OOP comes in at least two forms: a basic one in which the system provides some namespacing, simple polymorphism and data encapsulation, mostly just for utility; and a second form which takes the shape of a programming ideology that tries to fit every aspect of programming into an "object". One is useful for certain kinds of programming, the other is a retarded sham.

I regularly use classes in Python, if only for some simple namespacing (and because they're the only way to use structs in Python). It's nice to be able to write "method"/function names that are short since they cannot be accessed outside of the context of their class, and never need to be. Polymorphism has its use-cases, but they're not as common as OOP ideologues make them out to be.
>>
>>60032824

>a second form which takes the shape of a programming ideology that tries to fit every aspect of programming into an "object".
I hate this shit so much.
The worst part about programming paradigms is those faggots who think you can only use one.
>>
>>60032824
>for some simple namespacing
Write a submodule...
>>
>>60033009
I mean type-based namespacing. It is fairly nice to have the language be able to recognize that "op.couple()" means "faggot_couple(op)" rather than "straight_couple(op)" since "op" is a faggot in this particular context.
>>
>>60028942
>>have known python for 7 years now
>>done all sorts of fun shit with it

Translation

>Im a script kiddie who writes hacks
>Ive never worked on anything substantial
>>
OOP is very very useful for large projects, but 98% of the time it's not useful.

Also, Python was never meant to be used for OOP, it originally started happening as a shitty interpreter hack and eventually gained "real" support. It's a fucking disgusting mess of a language.
>>
>>60028942

Here are the only things you need to know to write good code with or without classes:

SRP
DRY

Specifically for classes and OOP: Composition > Inheritance

The classic animal inheritance tree here:

>>60032824

Is wrong and only said by idiots failing to properly teach OOP.
>>
>>60033274
>Is wrong and only said by idiots failing to properly teach OOP.
The problem is that there are so many of them. And not only amongst teachers, but there are many people who truly believe in it and try to apply it in practice.
>>
>>60033216
>Also, Python was never meant to be used for OOP, it originally started happening as a shitty interpreter hack and eventually gained "real" support.
In February 1991, van Rossum published the code (labeled version 0.9.0) to alt.sources.[10] Already present at this stage in development were classes with inheritance
>>
>>60028978
>its taking longer to write
That is why OOP exists, it's generally much faster to work with.
>>
$a = new File("animu.png");
$a.delete();


vs

file_delete("animu.png");



All OOP does is double the workload and improve nothing. It's fucking pointless.
>>
Anything OOP can do can be done in a header file.
>>
>>60034321
>what is overloading
>>
>>60028942

Objects are great on huge projects where you're able to trust the other people you're working with. If you're doing personal hack-jobs then there's no reason to over complicate things with them. I've seen Java coders take longer to structure their classes than it takes them to write the actual algorithms inside them.

The problem with OOP is the Oriented part. There are plenty of cases where objects are the best way to get something done, but there are several magnitudes more where they make things needlessly complex on the programmer to write and impossible for anyone else to read. Objects are a tool, but from the way a lot of people code it seems more like a necessity. It's like the first semester of CS was turned from "basics of programming logic" to "logical structures found in objects".

It's like the old saying goes, when all you have is a hammer, everything looks like a nail. OOB is a sledgehammer to a lot of code monkeys, partly because they were never taught any differently. Objects can be used with finesse, but when you job is nailing down railroad ties 8 hours a day, you reinforce bad habits.
>>
All of you are retarded. Oop is just a paradigm to help you organize your code into modular blocks and develop programs using composition. It's not inherently better or worse than other paradigms they all have trade-offs
Thread posts: 44
Thread images: 8


[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.