Results 1 to 10 of 21

Thread: Procedural v.s Object oriented programming?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Quote Originally Posted by chronozphere View Post
    You'll find that there are people who see OOP as a non-productive overly complex way of writing software.
    Strange... I see things like MVC has a non-productive, overly complex way of writing software, whereas OOP is just like a fundamental. It's a given. I wonder if I'd feel that way about MVC if I was involved in hectic multi-person projects...
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

  2. #2
    OOP is a way to think about software. Some people never got used to OOP (the oldschool coders) and others just love the C-feeling of procedural code. I can understand this, because the C language is very easy to understand, yet powerfull (The same can be said about pascal because you can consider it a superset of C, functionality wise). The problem with OOP is that it restricts your way of thinking about your code. The constructs in OOP are flexible at the beginning, but as a project progresses, you may run into all kinds of problems. For example, if you heavily rely on complex things like polymorphism, generics or operator overloading, it will be very hard to understand what's going on.

    About MVC, I think it has some good potential. For example, I'm working on a PHP web project, where I am using an MVC framework (KohanaPHP). I must say that for this kind of application, it works great.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  3. #3
    Quote Originally Posted by chronozphere View Post
    I'm especially interested in how inheritance is done with procedural programming.
    An example:
    Code:
    TYPE
      TClassA = RECORD
        PropA: INTEGER;
      END;
    
      TClassB = RECORD
        Parent: TClassA;
        PropB: INTEGER;
      END;
    Assuming INTEGER as 32 bit, both records have the "same" first 32 bit, so you can do something like this:

    Code:
    VAR
      TheObject: TClassB;
      OtherInstance: ^TClassA;
    BEGIN
      OtherInstance := POINTER (@TheObject);
      OtherInstance^.PropA := 1;
      WriteLn (TheObject.Parent.PropA);
    END;
    Add procedures and funcitions to the equation and here you have the beggining.

    Quote Originally Posted by chronozphere View Post
    (...) For example, if you heavily rely on complex things like polymorphism, generics or operator overloading, it will be very hard to understand what's going on.
    That's why I never use generics nor operator overloading. When I programmed C++ I had lots of problems with that. Sepcially with operator overloading, because a lot of times the compiler selected the wrong one doing weird conversions and returning bad data. The worst is that data is "valid" so it's hard to find where the problem is.

    BTW, I think most people don't use it correctly. It seems as they're using it because it's cool or because everybody uses it, but I'm not sure if they're really think about if it's really useful or helps to the development.
    Last edited by Ñuño Martínez; 08-10-2010 at 09:08 AM.
    No signature provided yet.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •