5 ms·
I've seen this posted here before. I take issue with anyone who gets onto a soapbox and announces "this might be the most important video you've ever watched" a
by vikingcaffiene 8y ago
I've seen this posted here before. I take issue with anyone who gets onto a soapbox and announces "this might be the most important video you've ever watched" and then proceeds to espouse their opinion about something. It's egotistical and it immediately sets up any dissenting opinions as Obviously Wrong. I call BS on all of it. OOP can be written well. I've done it. I've seen it done by others. When you need a strong domain layer and strong data integrity it can really pay off dividends. I think what people are really trying to avoid when they say "OOP is bad" is poor design and entangled concerns. In general favor composition over inheritance, strongly defined data contracts, and a clean separation of concerns (business logic from presentation for instance) and you will find yourself with more maintainable and easier to read code. But thats just like, my opinion man. :)
- mistrial9 8y ago> poor design and entangled concerns good on you to call BS a bit, but others have mentioned management of state specifically.. so "nouns" are ABCs, "verbs" defined, but after runtime for a while, and getting hammered or other difficult conditions, what is state like ? good OOP can be really useful, without being a religion.. personally I would build general-purpose objects here and there to save some tedious decomposition..and the resulting seperation of code and concerns was fine .. specific things get specific code, while one or two item constructs somewhere off the beaten path might get lumped into a collection of "util" or similar.. its ok - it takes some practice and thinking ..
- 0815test 8y ago> "this might be the most important video you've ever watched" This is standard practice on YouTube, for better or for worse - same with the usual appeal "hey, you can help me by liking, commenting and subscribing!" at the end. (I have not clicked on this video, so I have no idea if anything like that is in there too.) Gotta drive those "engagement" numbers!
- mrkeen 8y agoThis advice/reflection could apply equally to any style of programming, except for one particular snippet. You haven't made or refuted any OOP-specific claims. Separation of concerns? Egotistical soapbox speaker? Strong domain layer? What do they have to do with OOP, as opposed to just P? Except for this: > favor composition over inheritence Yes! Inheritance is OOP-specific, and I agree that you should avoid it.
- peteradio 8y agoBut why? Why avoid inheritance?
- vikingcaffiene 8y agoInheritance is a powerful tool. And like anything powerful, you need to think very hard about it use and assess whether another approach might be more well suited to what you are trying to accomplish. In my experience the reason people use inheritance is often simply to share common functionality. There are a lot of ways to get that done that don’t require inheritance.
- LoSboccacc 8y agoif done improperly one ends up having to maintain backward compatibility in the parent object not just on the actual interface but also in the internal state. basically makes it too easy to violate incapsulation one needs not to avoid it completely but need to be aware of the pitfalls
- anonuser123456 8y agoI think one of the reasons anti-OOP opinions are so strong is that OOP was promoted as the end all savior of programming. At my University it was dogmatically emphasized. "OOP" (e.g. subtype polymorphism) is useful for some problems, but worthless and kludgy for others; it's a hammer pounding lagbolts. A generation of programmers (mine) missed out on the richness of Lisp/ML flavored languages. I didn't really come to Lisp/Ocaml until a decade after I'd been programming and after embracing it, I can't imagine going back. Thankfully were in the multiparadigm era where modern languages are adopting the best of all world's.
- 0815test 8y agoThe biggest problem with OOP is arguably inheritance, specifically implementation inheritance. The basic issue is that "protected" methods may be extended arbitrarily by a child class, with zero indication of what properties might in fact be relied upon by methods in the parent; this inevitably leads to a rather intractable version of the Fragile Base Class problem. This pitfall of open-ended implementation inheritance (a.k.a. "open recursion"), which is precisely what "inheritance" per se provides over the well-known (and often used) combination of "object-based" composition and "interfaces"/traits/type classes, is pretty damning for OOP itself.
- zaphirplane 8y agointerestingly Lisp/ocaml/clojure rank low in popularity, clojure shows it’s not because of libraries. That has to mean something other than libraries or unenlightend people. Idk maybe there is too much complexity in those languages and philosophy
- Fellshard 8y agoLearning new languages is considered to be one of the highest costs a developer can pay. To be fair, there is a cost to picking up a new language, but nowhere near as high as is often believed, especially after one has learned two or three significantly different ones. I'd argue that those languages don't see as much use in great part because they are not the first languages people are exposed to, and therefore most decide it's not worth the effort to learn them.