4 ms·
I'll say it: NestJS is pure evil. It pushes OOP beyond its absolute limits. Not that I would consider OOP a good way to do things in general. Beyond misleading
by starbugs 3y ago
I'll say it: NestJS is pure evil. It pushes OOP beyond its absolute limits. Not that I would consider OOP a good way to do things in general. Beyond misleading autocompletions that look helpful at first glance, it's usually somewhat counterproductive in any language and with any framework I have ever encountered. But NestJS manages to make it pure pain and sadness. It's like a framework that spins around its own "architecture" making it nearly impossible to get stuff actually done.
Pro tip: If you find a paragraph celebrating "SOLID principles" at the beginning of the documentation of something, run.
- cosmosgenius 3y ago"Not that I would consider OOP a good way to do things in general" this statement doesn't make sense to me. My normal mental model for design in usually "Objects" with message passing. How is OOP bad in general?
- starbugs 3y agoPlease watch the video linked in the article. It explains it way better than I ever could in a comment: https://youtu.be/QM1iUe6IofM https://youtu.be/QM1iUe6IofM TLDR: The main culprit is encapsulation at a granular level. Explicitly associating functions with data types systematically. A side note: I personally think this applies to "OOP as done in the industry". There are exceptions. Erlang for example.
- jokethrowaway 3y agoSmalltalk OOP is good, I'd argue nowadays OOP in modern lingo is not objects and message passing anymore (call it actor model if you want to be understood) but C++ / Java classes. Namely I would say: - Inheritance: bad because adding layers makes it harder to understand what code is running - favor composition instead - Encapsulation: bad because it encourages mutable internal state and couple functions with data - favor immutable state Plenty of practices of doing good OOP are all about doing less OOP (eg. Avoid deep inheritance hierarchies).
- cosmosgenius 3y agoAren't inheritance, encapsulation concepts of OOP more than guiding principles "to be followed"? Understanding inheritance vs composition becomes the basis for anything OOP, as are with other concepts.
- starbugs 3y agoInheritance is considered harmful nowadays even if you ask the most hardcore OOP folks. That leaves us with composition, which isn't unique to OOP and eliminates one of the core "benefits" claimed by OOP proponents. (Object oriented thinking basically. Animal <- Cat, Dog, etc.) Your argument (as many others) falls into the category of OOP minimalism. Basically, it says: "Do less OOP". That's part of the philosophy for years now. It shows that OOP is essentially self defeating as there will be nothing of it left after every new "best practice" has advised us to get rid of each single OOP concept. It's time to wake up now.
- Verdex 3y agoWith circuit design you have OR gates and AND gates and NOT gates. However you can program everything with only NAND gates because with that gate you can express all other gates. Ultimately though using universal NAND gates is a convenience of manufacturing and not comprehension. Just imagine if we replace all of our Boolean operators with an equivalent NAND and then only use that. Probably not the most readable code. OOP has one trick: dynamic dispatch. Which corresponds to logical existential operator. You could also have product (structures ... depending on if you consider getters and setters proper OO then maybe it has this), sum (sum types and discriminated unions), implication (anon functions), and universal (generics). Yeah technically you can simulate everything with dynamic dispatch but then you kind of end up with a mess.
- cosmosgenius 3y agoI am not sure how dynamic dispatch relates too OOP in general, more than it being shown as an example use cases of OOP. (Pardon my ignorance). edit: yup ignorance shows. Going through couple of wiki dynamic dispatch means polymorphic methods.
- pawelduda 3y ago> Pro tip: If you find a paragraph celebrating "SOLID principles" at the beginning of the documentation of something, run. It's been a while now, but can't recall how many times I've been asked about SOLID and in reality the codebase was as solid as wet paper. It felt more like a buzzword thrown around so people can argue about hypothetical, perfect OOP code. So glad FP is more widespread
- yencabulator 3y agoAlso run away if you find a paragraph celebrating "FP" at the beginning of the documentation of something.