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?

-1

u/Sum1FromSomewhere May 05 '19

It's like saying "I hate the English language because in the few books I've read, the authors aren't good at structuring their stories."

3

u/glacialthinker May 05 '19

Completely failed analogy. Natural language doesn't impose much on structure. It's literary techniques like poetic form, essays, letters... these are what impose structure, and this is more like the effects of paradigm or orientation.