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.

-7

u/scientz May 05 '19

It sounds like you are doing it wrong. OOP is a way of thinking and modeling, not organizing or writing the code. You use the patterns and tricks where it makes sense, not because it was laid out in a book etc.

8

u/glacialthinker May 05 '19

I'm not doing it at all, generally. I'm talking about when I work with an OOP codebase or a subsystem which is written by someone who learned with Java and design patterns (too common these days).

3

u/Jump-Zero May 05 '19

I agree with you. I dont blame OOP itself, I blame C++ for being so verbose and influencing Java/C# which are verbose as hell too. Many design patterns can be accomplished with much tighter code using more modern languages.