6 ms·
Object-oriented programming is a disease, and I can't wait until we're collectively done with it. All of these abstractions, when rarely they are actually need
by ilugaslifg 10y ago
Object-oriented programming is a disease, and I can't wait until we're collectively done with it.
All of these abstractions, when rarely they are actually needed to express a program, can be naturally expressed within the type system, in a proper functional language.
The fact that there's this encyclopedia of hundreds of discrete things with arcane toxic names that practitioners are required to individually learn and carry around in their heads, is a crime against our profession.
- dang 10y agoThis sort of heated rant makes for a bad HN comment, regardless of how correct your views are. It leads to flamewars, which we don't want here, so please don't post like this. Even if you took out the rantiness, the comment is still too generic to actually be saying anything. So to convert it to a good HN comment, you would need to both de-flamebait it and add information (e.g. specific examples).
- catshirt 10y agoi enjoyed the conviction.
- revscat 10y agoThere is far too much conviction in the world. One of the reasons HN is so enjoyable is that the discussions tend to avoid the heat that you can find just about anywhere else.
- iak8god 10y ago> There is far too much conviction in the world. Are you sure? :)
- dang 10y agoI can appreciate that, but empirically we know from long experience that such comments lead to downward spirals. That's why the site guidelines are the way they are; it isn't to dampen conviction.
- catshirt 10y agoso, if i'd noticed you were dang before i responded i probably wouldn't have. only because i was trying to form a consensus. i didn't realize the consensus was being explained to me. :)
- dang 10y agoNot sure I know what you mean but I'm glad you responded—I like it when people respond :)
- catshirt 10y agoi appreciate your rational/educational/hands-on style of guiding culture. so i was trying to say, without sounding like a pushover, that i may not have responded in fear of undermining your hard work. cheers & thanks sir!
- iak8god 10y agoI dislike OOP. It's my least favorite paradigm. The "objects-first" approach to teaching programming was such a bad idea. All that said, there is a place for OOP. And while a world without OOP would be a better place than a world without FP (if we had to choose), I think you'll be waiting a looong time for that world to materialize.
- cmoscoso 10y agoThat world is already here, just not evenly distributed.
- LyndsySimon 10y agoI've spent the vast majority of my career in OO-centric projects, but between my experience in Javascript and Clojure I've begun to see OO as FP with a layer of syntactic sugar. Objects are just closures at the end of the day, after all. The mental fun was when it dawned on me that most of the benefit from the FP I was falling in love with was coming not from FP itself, but from the liberal use of immutability... and that OOP can be written in a way that similarly embraces immutability. I don't know if my OO code got better or worse from an outside perspective once I realized that, but it certainly made it easier for me to reason about my experimental side projects.
- dkn 10y ago> arcane toxic names Oh come on. It's not "arcane" and I don't see how "toxic" has anything to do with the names of these patterns. Just an inflammatory comment.
- mavelikara 10y agoYes, and quite rich coming from the crowd which throws around Functors, Applicatives, Monads, Kiesli, CoYoneda etc.
- js8 10y agoI downvoted you - these are, unlike design patterns, very well-defined mathematical objects, but furthermore, you shouldn't use such a broad brush.
- mavelikara 10y ago> these are, unlike design patterns, very well-defined mathematical objects IMO naming these programing constructs after their arcane mathematical roots is toxic to the advancement of the field. OO design patterns do not have mathematical foundations, but that does not make them arcane or toxic. > you shouldn't use such a broad brush Probably not, I agree.
- js8 10y ago> IMO naming these programing constructs after their arcane mathematical roots is toxic to the advancement of the field. I disagree. Why not call a duck a duck, and instead invent your own terminology, just because you're in a different field? Mathematicians invented those concepts first, whether you like it or not. It's actually one of my three criticisms of (OOP) design patterns. Often they are just another names for a contrived way of how to pass functions as arguments, so they are actually bad abstractions (too little bang for the buck). (The other two criticisms are lack of formal definition and lack of representation in the computer language.)
- djeunneun 10y agoWhy is it a disease, honest question.
- hackits 10y agoTo do OOP good requires a lot of forward thinking and careful planning. Though most of the two are lacking supply when you're dealing with large teams of programmers and you end up with some IFactoryAbstractInterfaceInvoker eg... the kingdom of nouns game. The other main concern was it was over-hyped with consultants running around to all businesses during the dot net time with xml with no empirical evidence to backup their claims. The whole OOP was a giant experiment.
- hackits 10y agoJust for clarification. I'm not dishing OOP per say. My main concern is OOP emphasis (Java) is everything needs to be a class. There are times when there isn't a need for a noun for a bunch of functions that operate over a collection of abstract data types. The other problem is how OOP is first introduced to programmers. They're taught they need to categorizing everything into a taxonomy (classes) and inheritance. So the emphasis is incorrectly put on the art of taxonomy instead of getting the job done the most straight forward approach.
- Ace17 10y agoPlease let's not equate OOP with Java. There are actually OOP proponents like James Coplien and Trygve Reenskaug who think that Java is more "class-oriented" than "object-oriented", making it really hard to do proper OOP in Java.
- hackits 10y agoThere was a great talk by (David West) (https://www.youtube.com/watch?v=RdE-d_EhzmA&index=2&list=PLe7tfp6fIaMwPdD1s7yMDF9CRnLIm5T9L https://www.youtube.com/watch?v=RdE-d_EhzmA&index=2&list=PLe...) that does make the point that objects have little, if any, value as a programming concept Because all the arguments about objects occurred in the context of programming they focused on things that really don't matter much, like single versus multiple inheritance, dot notation versus explicit messages for getting and setting or invoking methods; class hierarchies, friends, even the idea of a class. He is more in favor programming of conceptualizing the real world as entities interacting with each other then designing systems that model those interactions. Thinking in objects allow one to design better systems that may not nesseary be represented as OOP in the language. Jumping to the conclusion of his talk, he more or less advocating in using Abstract Data Type instead of objects. That's what I got from it anyway. Though it kind of reinforces that OOP changes depending on who you talk too.
- hota_mazi 10y ago> All of these abstractions, when rarely they are actually needed to express a program, can be naturally expressed within the type system, in a proper functional language. If you think FP is mutually exclusive with OOP, you understand neither. OOP is very powerful to organize the architecture of your code and capture very common patterns such as reusing an existing piece of five functionalities while overriding one (something that's still awful to achieve in FP, regardless of the language you pick). FP operates at a more granular level, basically how you implement your methods. And by the way, FP has design patterns as well. FP and OOP are extremely complementary.
- runT1ME 10y ago>OOP is very powerful to organize the architecture of your code and capture very common patterns such as reusing an existing piece of five functionalities while overriding one (something that's still awful to achieve in FP, regardless of the language you pick). This is not true, ad hoc polymorphism works fine without subtype polymorphism.
- sdflkd 10y agoAgreed. Anyone who thinks this hasn't played enough with FP languages.
- hota_mazi 10y agoYou're absolutely right but you're not answering my objection. Show me an example of a type class with five functions and then how I can reuse it while overriding one of these five.
- lomnakkus 10y ago> Show me an example of a type class with five functions and then how I can reuse it while overriding one of these five. Huh? As I'm sure you're aware "type classes" != "classes", so I'm not sure why you're expecting them to be 'interchangeable' in this manner. It would be better to ask for some functionality (not a mechanism, as you're asking) and then show how one could be achieved[1] in one, but not the other. Personally, I think any kind of implementation override is a code smell. If you need common functionality, just have a plain function outside your class and use that from both interface overrides. [1] "Elegantly" or "expressively", one presumes. Of course everything can be achieved in any TC language.