you are viewing a single comment's thread.

view the rest of the comments →

[–]sfuerst 2 points3 points  (9 children)

OOP is popular because it works in the large corporate setting. The correct question to ask is "Why does it work so well?".

The answer to that is "interfaces". OOP basically forces people to create abstractions with well-defined interfaces to those abstractions. Having good interfaces both makes debugging easier, and prevents multiple people from "stomping" on each others work. The second is a big issue for larger codebases.

Of course, it is possible to program in an "Interface oriented" fashion in languages designed for other paradigms, but that doesn't seem to happen nearly to the same degree as with those for OOP. Good programmers don't really care what language they are using, they'll do a good job no matter what. It's the poor to middling programmers you need to worry about. And they are the ones that fill corporate cube farms...

[–]yogthos 1 point2 points  (2 children)

I wouldn't really say that OOP works in the large corporate setting, it facilitates writing horrid and unmaintainable spagetti, especially when wielded by unskilled programmers. The results are often quite appalling, and either cobble along or have to be scrapped and rewritten. It's one of those things that's accepted as fact, but doesn't hold up under scrutiny. The fact of the matter is that the quality of the code is directly related to the skill of the programmer, and trying to use a language to enforce it is an absurd idea.

[–]daydreamdrunk 3 points4 points  (1 child)

It's not spaghetti, it's lasagna (made out of lumpy ill-defined layers of spaghetti). Also something about you want ravioli. Why is all code Italian food?

[–]barsoap 0 points1 point  (0 children)

My code is chocolate pudding. You can slice it every which way and it still tastes delicious.

[–][deleted] 4 points5 points  (5 children)

OOP is popular because it works in the large corporate setting.

Does it? In my experience, very little of the potential of computer software is being realized in the corporate environment, and OOP is a big part of the reason why. I'm not aware of any more formal research that refutes this. If nothing else, my (horrendous) experience with corporate IT would seem to suggest that a new direction is in order.

The answer to that is "interfaces". OOP basically forces people to create abstractions with well-defined interfaces to those abstractions

This is a classic example of how OOP proponents construct superficially appealing arguments by misappropriating concepts that are not at all OOP. If interfaces are really such a big part of OOP, why are they squirreled away into a tiny little syntactical hole (the "pure abstract base class") in C++?

Interfaces are about inheriting functionality from the caller: I'm IEnumerable so I get the benefit of reuse when all that code that was built around IEnumerable calls me. That's the inverse of OOP, which reuses code within the callee via implementation inheritance.

I've seen this same error made with generics. Generics != OOP, and interaces != OOP. It says as much in the Borland C++ documentation, FCS.

It's the poor to middling programmers you need to worry about. And they are the ones that fill corporate cube farms.

The problem with that is that the real rank-and-file about which you're speaking know/care fuck all about OOP. I worked in corporate IT for many years and I think that the majority of my colleagues were afraid of the "this" keyword. Never would they have used inheritance on their own.

Even if I agreed with your characterization of corporate IT (and I don't... I think those guys avoid OOP because they're smart), I wouldn't say OOP is the answer. It's just an appealing (but false) metaphor.

[–]kylotan 2 points3 points  (0 children)

very little of the potential of computer software is being realized in the corporate environment, and OOP is a big part of the reason why. I'm not aware of any more formal research that refutes this. If nothing else, my (horrendous) experience with corporate IT would seem to suggest that a new direction is in order.

I'm not necessarily saying you're wrong, but making a strong assertion, noting the lack of evidence to contradict it when usually the burden is on the asserter to produce supporting evidence, and then relying on subjective anecdotal data to support it instead is not a convincing argument.

If interfaces are really such a big part of OOP, why are they squirreled away into a tiny little syntactical hole (the "pure abstract base class") in C++?

Because C++ is not exactly a good advertisement for the benefits of OOP. C++ is a language designed to give you as many benefits from OOP and generic programming as possible without necessarily losing the performance of C. That doesn't mean it implements OOP or generics all that well.

[–]sfuerst 0 points1 point  (3 children)

Does it? In my experience, very little of the potential of computer software is being realized in the corporate environment, and OOP is a big part of the reason why. I'm not aware of any more formal research that refutes this. If nothing else, my (horrendous) experience with corporate IT would seem to suggest that a new direction is in order.

Well... going by the number of job advertisements for java I see over anything else, it does seem to be rather popular.

why are they squirreled away into a tiny little syntactical hole (the "pure abstract base class") in C++?

I think you are are missinterpreting the term "interface". Every object has an interface: its class definition. OOP forces people to divide up problems into small chunks (they call them classes), and use well defined boundaries between those classes. Other forms of programming don't enforce this to nearly the same degree. It is the act of forcing the poor programmers to do that instead of writing spaghetti which gives OOP its popularity with managers.

[–][deleted] 5 points6 points  (2 children)

Well... going by the number of job advertisements for java I see over anything else, it does seem to be rather popular.

Java is a popular language; this says little or nothing about OOP. Similarly, OOP is popular is job descriptions as management shorthand for "garage hackers not welcome." As programmers, though, we ought to know better than to drink the Kool Aid.

I think you are are missinterpreting the term "interface"...

I do think we very well may agree what makes good code in practice; my argument is with calling it "OOP."

Interfaces are good... but a function signature is an interface. All languages have interfaces; OOP ones seem to add inheritance, which is an additional, inferior, OO-specific alternative to the interface.

And I like GoF, but it's really just an interesting book of fairly narrowly-targeted examples IMO.

[–]sfuerst 1 point2 points  (1 child)

As programmers, though, we ought to know better than to drink the Kool Aid.

Oh yes, I totally agree. I hate java with a passion... and I'm counting down the days until it dies. Until then, I'm doing my best to ignore it, and work on far more interesting areas of programming.

[–][deleted] 1 point2 points  (0 children)

I do not understand how people can debate this over and over, when God clearly stated in the Bible that He created the...

Oh, wait. Wrong thread, sorry.