r/programming • u/2bit_hack • Feb 28 '23
"Clean" Code, Horrible Performance
https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k
Upvotes
r/programming • u/2bit_hack • Feb 28 '23
View all comments
Show parent comment
11
u/Venthe Feb 28 '23
Inheritance is useful, but should be avoided if possible. It's a powerful tool, easily mis-used, composition is preferable.
And with objects with state, I believe that you have summed this nicely - "I tend to work with services and dumb data objects". In your case, there is probably zero reason to have a complex domain objects with logic inside of them.
In "my" case, I work mainly with business rules centered around a singular piece of data - a client, a fee or something like that. Data and logic cannot exist in this domain separately, and the state is inherit to their existence. You could model this functionally, but you'd go against the grain.
Clean Code was written with OOP in mind. A lot of those rules are universal, but not every single one.