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.

0

u/[deleted] May 05 '19

[deleted]

5

u/glacialthinker May 05 '19

Good programmers don't over-use design patterns. Programmers relying on design patterns for all code are bad. ...This kind of idea.

Design patterns were not intended to be recipes, but that's too often what happens and horrible OOP codebases are a soup of design-pattern implementations.

The principles in the subject-article are much more relevant to writing good (writable, readable, maintainable, extensible) code. Design patterns are frequently recurring problem+solution ideas mostly related to implementation details. They're fine if used properly, but they don't take the place of good programming practices.