Thread: Why OOP?
View Single Post
Old Oct 13th, 2007, 10:59 AM   #41
Darkhack
Hobbyist Programmer
 
Darkhack's Avatar
 
Join Date: Dec 2005
Location: Kansas City
Posts: 102
Rep Power: 3 Darkhack is on a distinguished road
Send a message via AIM to Darkhack
Quote:
Originally Posted by Arevos View Post
You seem to be labouring under the assumption that you need a language specifically created for OOP, which, as DaWei has pointed out several times in the past, is simply not the case.
OOP can be good when used properly. The thing about GObjects is that while it may be OOP, it is still confined to the rules of C, which makes it FAR more sane to use than C++ which requires a PhD to fully understand. Also, be careful not to confuse the idea of OOP with modularity. They are different. The idea of OOP isn't bad, but it can be easily misused. It is much easier to create a hard to read program with OOP than it is without. In particular, inheritance because instead of saying "W is made up of components X, Y, and Z". You are saying "W is X with Y and Z changes". The flow from simple functions building up to create more complex ones is now broken and you've added a crap load of complexity. Applications that use inheritance are simply harder to maintain. With procedural programming, functions are very predictable. With inheritance there is a LOT of ambiguity as to which is which and in what ways does this subclass override the parent class. Multiple inheritance is the biggest joke of all. With procedural programming, once you are familiar with the codebase, you can be quite productive. With multiple inheritance in use, you will be constantly checking the documentation to see which variables and methods are overridden. If you are working on an open source project, trying to follow the changes made by other programs to classes with inheritance requires you to practically relearn the entire class. It's just too difficult to use. I don't care what features [insert language here] adds to make inheritance more sane. It's still a nightmare and shouldn't be used. The "is a" relationship acts like spaghetti code on complex projects.

Please don't misunderstand. OOP can be a huge benefit to developers if you realize what features are sane and which aren't. Grouping together data with methods and being able to create multiple instances of a class is pure genius. Everything else... not such much, except maybe in a few isolated cases (hell, even goto is acceptable once in a rare while if you know what you are doing).
Darkhack is offline   Reply With Quote