Thread: So, "object-oriented" programming...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User MacNilly's Avatar
    Join Date
    Oct 2005
    Location
    CA, USA
    Posts
    466

    So, "object-oriented" programming...

    ...What does it really mean?

    I'm interested in your opinions on "object oriented" programming. I've been around, and heard all the counter-arguments. I think what OOP really boils down to is this: single dispatch functions with an implicit "this" argument, and class-based polymorphism. Data hiding is ubiquitous. Class based inheritance is problematic; composition is to be preferred. Algebraic data types offer more generality than classes. "OOP" seems to be a sham.

    I've been studing OOP since Borland C++ first came out. I knew procedural code, like QBASIC and straight C. The examples from the OOP style, with the toy hierarchies, I admit... were cool, and made a lot of sense... at least for a toy examples. I've dealt with real world code that had 5 or 6 layers of inheritance, for really no reason.. except to keep me on my toes. I saw way too many mutable variables, when there was absolutely no need for it. Too many cowboy programmers creating class instance variables just to pass a result from one method to another... when there was no need at all.. the methods could just return the result to the next... and I refactored a huge mess. Not to mention, those "methods" could just as well have been declared as static functions, once the dependency on the implicit state was removed..

    It leaves me wondering if there is any real benefit to "OO" programming? I understand it thoroughly, and it is definitely beneficial when state must be shared.. but shouldn't we strive to eliminate state, as it makes our programs hard to reason about?

    EDIT:

    In my experience, refactoring the "OO" code, trying to use classes (in C# and Java) as namespaces for static methods, served to eliminate many unnecessary dependencies that were created by uncaring developers, who just threw in random instance variables that went unused between method calls. I'm of a belief that eliminating stateful variables as much as possible is the right path to good design..

    EDIT(2):

    Be nice and I'm not trolling.. Just want to get the opinions here. I've been here a long time and its hard to find a good place to talk about this stuff elsewhere!
    Last edited by MacNilly; 02-13-2017 at 07:32 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-08-2014, 08:12 PM
  2. Replies: 9
    Last Post: 09-19-2011, 03:12 AM
  3. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  4. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM
  5. "Object reference not set to an instance of an object"
    By Manitoadlet in forum C++ Programming
    Replies: 6
    Last Post: 09-10-2002, 06:09 PM

Tags for this Thread