This commit is contained in:
Miloslav Ciz 2024-02-28 14:43:12 +01:00
parent e0e62826e2
commit 74cc61fae6
18 changed files with 1702 additions and 1681 deletions

6
oop.md
View file

@ -2,7 +2,7 @@
*"I invented the term 'object oriented' and [C++](cpp.md) was not what I had in mind"* --[Alan Kay](alan_kay.md), inventor of OOP
Object-oriented programming (OOP, also object-obsessed programming, objectfuscated programming or artificial inelegance) is a [programming paradigm](paradigm.md) that tries to model reality as a collection of abstract objects that communicate with each other and obey some specific rules. While the idea itself isn't bad and can be useful in certain cases, **OOP has become extremely overused, extremely badly implemented and downright forced in programming languages** which apply this [abstraction](abstraction.md) to every single program and concept, creating [anti-patterns](anti_pattern.md), unnecessary issues and of course [bloat](bloat.md). We therefore see OOP as a **[cancer](cancer.md) of software development**. Many others oppose it, e.g. [Bitreich](bitreich.md) voice criticism in their manifesto, saying we rather need a *subject oriented programming*; the idea of OOP being real bad is leaking even into the mainstream so it's becoming less and less controversial to shit on it.
Object-oriented programming (OOP, also object-obsessed programming, objectfuscated programming or artificial inelegance) is a [programming paradigm](paradigm.md) that tries to model reality as a collection of abstract objects that communicate with each other and obey some specific rules. While the idea itself isn't bad and can be useful in certain cases, **OOP has become extremely overused, extremely badly implemented and downright forced in programming languages** which apply this [abstraction](abstraction.md) to every single program and concept, creating [anti-patterns](anti_pattern.md), unnecessary issues and of course [bloat](bloat.md) We therefore see OOP as a **[cancer](cancer.md) of software development**. OOP is basically a fashion wave that scarred programming for decades. Many others oppose it, e.g. [Bitreich](bitreich.md) voice criticism in their manifesto, saying we rather need a *subject oriented programming*; the idea of OOP being real bad is leaking even into the mainstream so it's becoming less and less controversial to shit on it.
Ugly examples of OOP gone bad include [Java](java.md) and [C++](cpp.md) (which at least doesn't force it). Other languages such as [Python](python.md) and [Javascript](javascript.md) include OOP but have lightened it up a bit and at least allow you to avoid using it.
@ -39,6 +39,10 @@ OOP furthermore comes with some basic principles such as:
- If you want to program in object-oriented way and have a good justification for it, **you don't need an OOP language anyway**, you can emulate all aspects of OOP in simple languages like C. So instead of building the idea into the language itself and dragging it along forever and everywhere, it would be better to have optional OOP libraries.
- It generalizes and simplifies programming into a few rules of thumb such as encapsulation, again for the sake of inexperienced noobs. However there are no simple rules for how to program well, good programming requires a huge amount of experience and as in any art, good programmer knows when breaking the general rules is good. OOP doesn't let good programmers do this, it preaches things like "global variables bad" which is just too oversimplified and hurts good programming.
## The Pure OOP
TODO
## So Which Paradigm To Use Instead Of OOP?
After many people realized OOP is kind of shit, there has been a boom of "OOP alternatives" such as [functional](functional.md), [traits](traits.md), [agent oriented programming](agent_oriented_programming.md), all kinds of "lightweight"/optional OOP etc etc. Which one to use?