loading...

OOP is great! And here is why!

fpuffer profile image Frank Puffer ・1 min read

My first impression of OOP, many years ago, coming from C programming: Cool, let's put everything into a class and declare some attributes. These are like global variables but without the bad smell. No more need to pass too many arguments around.

It took me a few years to find out that this is not the real benefit of OOP.

Unfortunately, when looking at OOP code today, many developers still seem to adhere to this mindset.

Unfortunately this is how OOP is still being taught at schools.

Discussion

pic
Editor guide
Collapse
theelectricdave profile image
David S.

What was the benefit?

Collapse
fpuffer profile image
Frank Puffer Author

There are cases where it makes sense to encapsulate stuff in objects as opposed to functions. These are probably the ones where you can come up with a really good (descriptive) name for the class.

There are probably even a few domains where inheritance makes code easier to understand, sometimes one has to deal with these strictly hierarchical structures. UI component libraries might be an example but I am not sure.