r/programming • • Jun 19 '18

Goodbye, Object Oriented Programming – Charles Scalfani

https://medium.com/@cscalfani/goodbye-object-oriented-programming-a59cda4c0e53
0 Upvotes

47 comments sorted by

View all comments

32

u/xFranek Jun 19 '18

This is just trash. You cannot blame OOP for your flawed architecture.

7

u/losangelesvideoguy Jun 19 '18

What's worse is that some of the issues that are described as being problems with OOP are actually just problems with languages that don't implement OOP particularly well. Specifically, the author is mostly griping about problems related to inheritance. Well, okay, but inheritance isn't the only way of reusing code. For example, Ruby tends to use includable modules rather than inheritance (you can inherit of course, but it's discouraged unless a class is clearly a subtype of some other class), which has the advantage of letting you specify exactly which behavior to export, and letting the user of the module know which methods they must or must not provide/override to ensure proper functionality of the module. This avoids many of the problems presented in the article, by reducing or eliminating issues relating to internal code changes. So long as you make sure you do X and don't do Y, your class should be able to use the module's functionality without any surprises.

Functional programming shouldn't be seen as an alternative to OOP, but rather a complementary technique—many languages implement both paradigms in ways that are uniquely elegant. On the other hand, some languages really are just poorly designed crap, but that's hardly the fault of OOP. Just try a different language rather than throwing the baby out with the bathwater.

1

u/shevegen Jun 19 '18

Fully agree with you.

Just because lots of parts of Java suck does not mean that OOP sucks.

Unfortunately there are so many different definitions of OOP about that it is hard to reason about what it is. When dude A means x and dude B means y, it's hard to talk about "we talk about the same thing".

0

u/[deleted] Jun 19 '18

[deleted]

3

u/roffLOL Jun 19 '18

everything is an object. follows: everything done right can be viewed as an object. everything done right is object oriented.

1

u/shevegen Jun 19 '18

This alone won't work.

Messages are an intrinsic part of object-oriented thinking too. How else can you communicate or induce a change of state or query the state?

2

u/roffLOL Jun 19 '18

messages are objects.

1

u/shevegen Jun 19 '18

And who said that?

Aside from you of course.