r/programming • • May 05 '19

10 OOP Design Principles Programmer Should Know

https://hackernoon.com/10-oop-design-principles-every-programmer-should-know-f187436caf65
2 Upvotes

44 comments sorted by

View all comments

25

u/glacialthinker May 05 '19 edited May 05 '19

I tend to hate OOP because of the poor quality of code which results: 10% of the code being relevant to the problem, the rest being boilerplate, excessive interface and encapsulation fluff (which also has to change as the program evolves anyway), redundancy because of object hierarchies tied to types/data or functionality hidden by abstraction, and more...

However, this set of principles (the article) can lead to much better object-oriented code, and most of them can apply to programming in general. I'd rather work with programmers following these principles (though reserving heavy encapsulation for library or external interfaces) than working with a tool-belt full of design-patterns.

1

u/devraj7 May 05 '19

Did it ever occur to you the bad OOP code you're seeing has a lot more to do with the quality of the programmers who wrote it than OOP per se?

5

u/editor_of_the_beast May 05 '19

Idk. The best OO code to me looks like a poor manual implementation of functional code.

1

u/ScientificBeastMode May 06 '19

This is basically what I’ve seen as well. It’s really interesting how my code quality has improved in traditionally OOP languages after spending a little time in FP land. It’s like suddenly I understand what classes can really do if you design them well...

But any engineer in any field will tell you that human error is the enemy of all good things in the world. Trusting every programmer to know good OOP design, and also execute it, is simply bound to fail.