Object-Oriented Programming is...





  • Why does OOP dominate the industry? Simple: it does well with something that no other paradigm is any good for, namely GUIs. It also is the obvious choice for a lot of kinds of simulation, but that's what it was designed for in the first place so that makes sense.

    Is it a good general-purpose design approach? FUCK NO. No such thing exists. The only general paradigm is procedural, which is equally mediocre for all tasks. Every other paradigm is a specialized tool that really is useful for only a limited set of cases.

    OOP has a niche and fills it well, but too many programmers seem to be only able to understand one paradigm at a time, and if you need a GUI you need OOP.


  • FoxDev

    @ScholRLEA OOP also works quite well with complex data exchange and event-driven scenarios (of which GUIs are one)



  • I saw one of this guy's videos the other day, and I wasn't impressed.
    His whole argument hinged around rewriting horribly contrived OOP examples and saying "See? It's easier to read now!". Well duh, they were horribly contrived examples.



  • Got about half-way through first video. This guy doesn't understand the difference between abstract and concrete; IE how generalized something is and he's starting to sound like the kind of idiot that thinks a 1-tier system is good because "simplicity"...



  • @MathNerdCNU I'm sure we discussed the original video before. I watched the sequels a few days ago and wanted to post them, but couldn't find the thread.

    Anyway, the guy has some compelling points, but in the end, I just don't buy his argument.

    The best proof is the final product of his last video. Basically, he rewrote a NES emulator using his preferred procedural style and was bragging how much easier it was to grok than the OOP version. But all I could see were these huge nested procedures with ginormous switch statements. Kind of like the callback hell from node, only without any of the benefits. I'd like to see him actually try to test any of that code.

    There's a point buried there somewhere about avoiding cutting up your classes into too tiny pieces. But he goes way, waaay off into the other direction, and just creates a mess of a different kind.



  • @cartman82 Wouldn't be the first time I reposted something previously posted. But NodeBB's search sucks as much as :disco:🐎 so no harm no 🐔 ?


  • I survived the hour long Uno hand

    @RaceProUK said in Object-Oriented Programming is...:

    and event-driven scenarios

    Which is part of why Node is weird: it's event-driven without (until just recently) proper classes.



  • @Yamikuronue said in Object-Oriented Programming is...:

    it's event-driven without (until just recently) proper classes.

    Except those "classes" are just syntactic sugar over setting everything up the old way, with prototype chains. Huge letdown IMO.


  • FoxDev

    @Yamikuronue OOP doesn't always mean classes though; before the syntax was added in ES6, JS objects were defined via prototypes or JSON, and Node adds modules as another way of defining objects.


  • Garbage Person

    @cartman82 The LOC count is the most instructive. A line of code is, basically, a single discrete operation that can be understood atomically.

    If they're the same, that means the same number of operations are being done, which suggests they're more or less the same operations, which means you're just bikeshedding and reorganizing.

    Of course, a class and a function/method should also be understandable as single purpose atomic operations. Having taken 321 of them and turned it into 113 while maintaining LOC count suggests that the 'single atomic operation' assumption has been violated. The only other possibility is that boilerplate was reduced - but that would have reduced LOC count, and to maintain that, more complex algorithms must have been needed to implement in the new paradigm.

    Anyone that gives even half a shit about how many files are in their project needs an IDE. "Hurrdurr whar is that implemented? move cursorPress F12File opens and relevant code appears



  • @Weng said in Object-Oriented Programming is...:

    Anyone that gives even half a shit about how many files are in their project needs an IDE. "Hurrdurr whar is that implemented? move cursorPress F12File opens and relevant code appears

    My reaction to about 80% of newfangled programming innovations is, "just use a fucking IDE, idiot".


  • Notification Spam Recipient

    Just out of curiosity. How readable was the end product? Did he have some kind of metrics to measure his end result? What was his intended goal besides bike shedding code?

    Going back to my first question I've usually found the biggest overhead is decrypting other people's code. Usually my own!



  • This guy doesn't understand the goals of OOP. OOP was invented to make difficult things manageable, not to make easy things trivial. Every time I see someone looking at a whole project and saying "I can't figure this thing out, it's unreadable!", I start to wonder how they would deal with a truly complicated system that there is zero hope of ever understanding completely.


  • Winner of the 2016 Presidential Election

    @blakeyrat said in Object-Oriented Programming is...:

    My reaction to about 80% of newfangled programming innovations is, "just use a fucking IDE, idiot".

    OTOH, turning some of the IDE's code inspections into compiler features (e.g. catching more errors via the type system) to make sure that programmers don't shoot themselves in the foot regardless of which IDE they're using is not a bad idea, either.



  • 41:30 - the feature he is discussing does exist in one group of languages, and is widely used in them. Take a guess which languages I mean.

    So yes, (let) and (progn) are things (as is (lambda), of course, which they can be built on if you don't care about efficiency), and yes, they do what he seems to be looking for here, unless I miss my guess.

    EDIT: sorry, that was a dumbass attack on my part; the key here was that it not have access to the enclosing scope, and I missed that part.

    But I bet I could write a macro for it in Common Lisp. Scheme? Maybe, maybe not; lexical scope was sort of the whole point of Scheme originally so it would be going against the language in a big way. And it is totes going on the list of things to support in Thelema.



  • Does anyone else find the recent--is this mostly recent?--backlash against OOP exaggerated, bordering on the original anti-goto campaigns? I'm seeing a lot of articles that seem more like hype backlash rather than critical examinations. More examples:

    From one of the programmers working on The Witness (Jonathon Blow's latest game): http://mollyrocket.com/casey/stream_0019.html (gotta love random hyperlink formatting...)

    A Python talk entitled "Stop Writing Classes": https://www.youtube.com/watch?v=o9pEzgHorH0

    The problems highlighted here seem not to be about OOP, but writing classes where not appropriate. In the projects I've worked on, I've seen too many classes which only contained methods and no data. I end up deleting the class and turning the methods into functions just by changing the indentation.

    The most even-handed criticism I can find is from James Hague:

    http://prog21.dadgum.com/156.html
    It's not that OOP is bad or even flawed. It's that object-oriented programming isn't the fundamental particle of computing that some people want it to be. When blindly applied to problems below an arbitrary complexity threshold, OOP can be verbose and contrived, yet there's often an aesthetic insistence on objects for everything all the way down. That's too bad, because it makes it harder to identify the cases where an object-oriented style truly results in an overall simplicity and ease of understanding.

    Maybe it's because I'm not primarily a programmer (when I program it's mostly physics simulations in C++) that I missed the object hype train. Am I wrong in thinking all this anti-OOP writing is mostly a reaction to people who learned Java just to get a high-paying job in the 90s?


  • FoxDev

    @MZH said in Object-Oriented Programming is...:

    bordering on the original anti-goto campaigns

    Those at least have some justification; goto encourages sloppy code design



  • @RaceProUK Agreed. I was just comparing the level of vitriol.



  • I tried to watch the entirety of the first video, really I did.

    However, I lost my patience with this guy once he started talking about abstract.

    Seriously, Brian Will use a fucking dictionary and note how words can (and do) have more than one definition.


  • Winner of the 2016 Presidential Election

    @MZH said in Object-Oriented Programming is...:

    Am I wrong in thinking all this anti-OOP writing is mostly a reaction to people who learned Java just to get a high-paying job in the 90s?

    Nope. People who hate static typing and/or OOP most likely do so because of Java.


  • I survived the hour long Uno hand

    @asdf Am I TR :wtf: because I don't understand what's so very very wrong with Java? I mean, all languages have their idiosyncrasies. I've seen a lot of bad Java code, but the language itself isn't responsible for that in the same way that Perl is; it's the enterprise frameworks that sit on top.


  • Winner of the 2016 Presidential Election

    @Yamikuronue said in Object-Oriented Programming is...:

    Am I TR because I don't understand what's so very very wrong with Java?

    Nope, because this is what I'm constantly repeating on this forum as well whenever someone bitches about the quality of Java programs:

    I've seen a lot of bad Java code, but the language itself isn't responsible for that

    OTOH, you have to admit that Java makes beginners hate both OOP and static typing due to:

    • Requiring casts everywhere because of type erasure and because it doesn't support co-/contravariance, which basically defeats the whole point of static typing
    • Not supporting type inference, tuples or ad-hoc structs and therefore requiring you to declare and type types all the time
    • Not having any support for properties with auto-generated getters and setters
    • Not allowing methods outside of classes

    The language isn't completely fucked up, but it lacks a lot of convenience features which a modern OO and statically typed language should have.


  • Discourse touched me in a no-no place

    @Yamikuronue said in Object-Oriented Programming is...:

    Am I TR :wtf: because I don't understand what's so very very wrong with Java?

    I think it's partially a bunch of people who don't understand it at all, partially a reflection of problems with running code in browsers, and partially a “this isn't my choice therefore it must be wrong” mentality (a disappointingly common approach, for example most of the “hurr durr use C#” noise). There's a few criticisms from the OOP purists because it doesn't force everything to be an object that are more valid, though they're really not that important in reality.

    There's also a lot of people upset with enterprise-level computing and who think that it's got to be simpler than Java makes it. Those complaints are either about code without a support framework (why would you do that!?) or are about the general level of complexity that actually has to be present. Many of the features might not be needed in one use-case, sure, but that's got almost nothing to do with the next use-case along.


  • I survived the hour long Uno hand

    @asdf said in Object-Oriented Programming is...:

    Not having any support for properties with auto-generated getters and setters

    This one I quibble about, because beginners shouldn't be learning to rely on magic auto-generated crap, and in .NET it's very easy to fuck up and end up in a recursive infinite loop trying to write a getter once you do start down that path.

    But yeah, tuples and methods outside classes would be nice. That's the kind of thing I meant when I said

    @Yamikuronue said in Object-Oriented Programming is...:

    all languages have their idiosyncrasies


    @dkf said in Object-Oriented Programming is...:

    a reflection of problems with running code in browsers

    Confession time: I've never written an applet in over 10 years of knowing Java. People still do that? Intentionally?


  • Discourse touched me in a no-no place

    @Yamikuronue said in Object-Oriented Programming is...:

    People still do that? Intentionally?

    Yes. 😢 😭


  • Winner of the 2016 Presidential Election

    @dkf said in Object-Oriented Programming is...:

    There's a few criticisms from the OOP purists because it doesn't force everything to be an object that are more valid, though they're really not that important in reality.

    The fact that autoboxing is even a thing / that you cannot use primitive types as parameters for generics can create real problems.


  • ♿ (Parody)

    @asdf said in Object-Oriented Programming is...:

    The language isn't completely fucked up, but it lacks a lot of convenience features which a modern OO and statically typed language should have.

    I think that a lot of the hate began when in addition to just writing java you also had to write oodles of obscure xml files in obscure places. There's still some of that, of course, but the rise of annotations has greatly improved that.

    But yeah, type erasure is annoying (though honestly I don't think it's caused me much in the way of actual problems / errors) and it's a bit verbose, but I honestly prefer that to the magicalness of perl or ruby :spit:.


  • Winner of the 2016 Presidential Election

    @boomzilla said in Object-Oriented Programming is...:

    but I honestly prefer that to the magicalness of perl or ruby

    Mentioning perl and ruby as the alternative is a bit of a strawman. If you want to see what Java should be, take a look at Kotlin or Ceylon. Groovy and Scala have some good ideas as well, although those languages have their own flaws.


  • ♿ (Parody)

    @asdf said in Object-Oriented Programming is...:

    Mentioning perl and ruby as the alternative is a bit of a strawman.

    No, I'm just talking about what I'd consider to be extremely opposite on java's verbosely explicit nature.


  • Winner of the 2016 Presidential Election

    @boomzilla OK, I think we can (almost) all agree the Ruby is absolutely horrible.


  • I survived the hour long Uno hand

    @asdf said in Object-Oriented Programming is...:

    I think we can (almost) all agree the Ruby is absolutely horrible.

    @asdf said in Object-Oriented Programming is...:

    Groovy

    Isn't Groovy essentially "Ruby, but more Java-esque"?



  • Responses to first 20 minutes of first video:

    • "This is the most important video on programming you will ever watch."

    Get over yourself. Tef's Programming is Terrible: Lessons from a life wasted is much more important (bonus points for Jeff Atwood and Paul Graham hate).

    • "A supposed advantage of Java is exceptions, whereas C and C++ have to use return codes."

    No exceptions in C++? :wtf:

    • Method calls = shared private state = shared global state

    :wtf: Maybe if you squint and tilt your head, but not really.

    Meh. That's all I can take.

    The problem is trying to do pure anything in programming. Pure OO leads to ridiculousness like AbstractFactoryBeanFactoryVirtualFavaBeanSingleton. Pure functional programming leads to programs with no effect on the outside world that just turns your computer into a space heater.


  • Winner of the 2016 Presidential Election

    @Yamikuronue said in Object-Oriented Programming is...:

    Isn't Groovy essentially "Ruby, but more Java-esque"?

    It's not entirely unlike Ruby, that's why I just said that it has some good ideas, not that it's a great language.

    Edit: I should also add that whenever I write Groovy code, it ends up looking like non-shitty Java code, not like Ruby. That's how many people use Groovy. You can definitely write terrible, unmaintainable Groovy code, just like you can easily make Scala code as unreadable as Perl.


  • BINNED

    @asdf said in Object-Oriented Programming is...:

    Groovy code

    Is that when you code wearing elephant pants and strange sunglasses or something?


  • FoxDev

    @Luhmann Only if your project manager is MC Hammer


  • BINNED

    @RaceProUK said in Object-Oriented Programming is...:

    project manager is MC Hammer

    At least he won't let me touch that code



  • Got to love people who start with the whole industry is wrong but i know the truth. think I remember a few stories on here about that mentality



  • @Reddog said in Object-Oriented Programming is...:

    Got to love people who start with the whole industry is wrong but i know the truth.

    The first half of that sentence is obviously true; the second half probably won't be true for anyone in the lifetimes of our children's children's children.

    We write crappy code because no one knows how to write good code and learning how to will be the work of centuries to come, but code still needs to be written right now.



  • I've been watching bits and pieces of Tef's talk as I do some other things, but so far he seems pretty simpatico to my own thoughts. Whether that is a good sign or a bad sign, I'm not sure.

    What he says about the lack of teaching exploration, and the lack of explanation by instructors that professional programing is more about maintaining existing programs and communicating with the client than about writing new code is dead on the money. Similarly, the confusion people get about the relationship programming has to mathematics - which far too many people think means calculating values, when the really relevant connection has more to do with symbolic logic than arithmetic or algebra, and even then has almost nothing to do with how a mathematician would work with, say, predicate calculus - is correct as well.



  • @Yamikuronue Java has tons of problems, but they're 90% in the JVM and 10% in the actual programming language myself. The biggest criticism I have of the language itself is that its stewards are lazy and don't give a shit. (Which is also the reason the JVM is so awful, hm.) They're also the kind of shysters who'll change version numbers around to make it look like things are advancing faster than they actually are, kind of like when Firefox pulled that shit. (Java's version 7 has maybe 1/3rd the changes since 1.0 as .net's version 4.5. But it's a higher number so it must be better!)

    (Although just a few weeks ago we discussed that language problem with checked exceptions, basically what happens when after your code is written and shipped, a shared library you rely on adds a new exception type to a method. To which the answer seemed to be "nobody in Java-ville thought of that, so it all just breaks.)



  • @Reddog said in Object-Oriented Programming is...:

    Got to love people who start with the whole industry is wrong but i know the truth. think I remember a few stories on here about that mentality

    They're all in league with the great Binary conspiracy: https://www.kickstarter.com/projects/1784334872/4-dimensional-operating-system

    Big Binary!



  • @Reddog said in Object-Oriented Programming is...:

    Got to love people who start with the whole industry is wrong but i know the truth.

    Isn’t that basically how you start a religion?



  • @MZH said in Object-Oriented Programming is...:

    The problem is trying to do pure anything in programming.

    You may be surprised to hear this, but I agree with you. So why do I come across as a Lisp purist? Well, when I sound like that, it is because I'm talking about my (private, unfunded) experimental work on what really is fundamental in a programming language and what can be built from more primitive forms, and things like that, where the whole point is to take what most people assume are the atomic, core ideas of the field and try to disassemble them to see how they really work.

    In actual practical programming, most of my day is (or was) spent talking to people about the bad ideas they wanted implemented, or conferring with my cow-orkers about how best to suck off the client in a way that convinces them we did what they wanted when what they wanted was poorly conceived, underfunded, would require violations of causality to work, or any of the other idiocies I've seen in the wild.



  • @blakeyrat said in Object-Oriented Programming is...:

    checked exceptions,

    Is by far the worst about java. So much work for no damn reason. I like. Net exceptions - catch the ones you anticipate and/or can handle, ignore the rest.
    Dates in java is criminally bad, .net less so, but still not perfect.
    I've used swing, that really tested my patience. It required a whole damn ~100 line class to draw the equivalent of a datatable - you had to handle select manually.


  • Discourse touched me in a no-no place

    @blakeyrat said in Object-Oriented Programming is...:

    Although just a few weeks ago we discussed that language problem with checked exceptions, basically what happens when after your code is written and shipped, a shared library you rely on adds a new exception type to a method. To which the answer seemed to be "nobody in Java-ville thought of that, so it all just breaks.

    OTOH, breaking your downstream “contract” with users of the code by shoving new exceptions — new failure modes — at them can break stuff weirdly anyway. Anyone who does that is writing code that will be horrible to rely on for production use, whatever programming language they use.



  • @dkf said in Object-Oriented Programming is...:

    OTOH, breaking your downstream “contract” with users of the code by shoving new exceptions — new failure modes — at them can break stuff weirdly anyway.

    It could just be something as simple as moving a permissions check to a different function:

    • We now check for "PersonIsAGorilla" exceptions on user creation instead of waiting until the user is added to the "DanceClubDJs" collection.

    The behavior of creating a gorilla, then adding them to a dance club hasn't changed (it still fails, and still fails with the same exception), but your code is now broken because it's not checking the exceptions in the correct places.



  • @swayde said in Object-Oriented Programming is...:

    Dates in java is criminally bad

    Not as much anymore, but since everything deals with the old interface, it's going to take a long time for it to get better.



  • @JazzyJosh true, they were bad, now they're not that bad. But the legacy remains.



  • @Yamikuronue “java, but with ruby magic”, which might sound the same, but I feel better captures the way that groovy manages to combine all of the down-sides of the jvm's static type system with all of the down-sides of ruby's dynamic type system.