View Poll Results: Which do you prefer?

Voters
24. You may not vote on this poll
  • Object Oriented Programming

    20 83.33%
  • Procedural

    1 4.17%
  • Spaghetti Code!

    3 12.50%
Closed Thread
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39

Thread: OOP vs Procedural

  1. #1
    Jordan Guest

    OOP vs Procedural

    Which do you prefer, Object Oriented Programming or Procedural? Why?

    I prefer OOP. I like the ability to reuse code and the idea of a class makes more sense to me. Procedural code also has a bad habit of turning into spaghetti code.

    Some project I develop in PHP, it makes more sense to use Procedural style, however. For larger projects I feel that OOP is critical in order to develop code that is easily expandable.

    What about you?

  2. CODECALL Circuit advertisement

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: OOP vs Procedural

    I think it's something of a false distinction. OOP Methods are generally procedural, for example. See my upcoming OOP tutorial (not yet released) for more ideas
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: OOP vs Procedural

    Awaiting that tutorial WP =)

  5. #4
    Join Date
    Jul 2008
    Location
    Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
    Posts
    10,725
    Blog Entries
    2
    Rep Power
    90

    Re: OOP vs Procedural

    OOP is my favourite, I think. It seems to be a great tool to solve problems in a logical and clear way. Yet, I wouldn't turn down procedural programming. OOP can be a bit overkill at times.

    Spaghetti-code, on the other hand, is absolutely awful. I've done it, and it is a nightmare both to maintain and expand.
    Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

  6. #5
    Join Date
    Mar 2008
    Posts
    7,145
    Rep Power
    86

    Re: OOP vs Procedural

    Objects

    I like the idea of being able to reuse code as well. Lately I've found a use for object inheritance and it makes programs so easy to maintain. I don't know if procedural code can be written in a way that would be any easier to maintain. I haven't written much code that is "procedural".

  7. #6
    Join Date
    Aug 2007
    Location
    Gizeh, Al Jizah, Egypt, Egypt
    Posts
    8,675
    Blog Entries
    12
    Rep Power
    81

    Re: OOP vs Procedural

    well, i really like OOP
    but i find myself coding in Procedural style, specially in PHP , i mostly write set of related functions in a php file and include that file when i need them. im currently trying to be OOP person its seems easy when people talk about funny objects like "human" have hands and legs as private variables blah blah blah.... but in reality i find it hard to do a class for actual stuff
    yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
    Code:
    eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
    www.amrosama.com | the unholy methods of javascript

  8. #7
    PythonPower's Avatar
    PythonPower is offline Programming Professional
    Join Date
    Feb 2009
    Posts
    228
    Rep Power
    13

    Re: OOP vs Procedural

    The only thing OOP adds is code reuse whether by generality, easy extension or whatever.

  9. #8
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: OOP vs Procedural

    OOP is great. What you can do in three lines of procedural code, I can do in fifty lines of OOP.
    Code:
    <?php

    interface greeting {
        public function 
    hello();    
    }

    class 
    hello implements greeting {
        
        public function 
    hello() {
            return 
    "Hello ";
        }
        
        public function 
    __toString() {
            return 
    $this->hello();
        }
    }

    class 
    say {
        private 
    $a;
        public function 
    say($a) {
            
    $this->$a;
            return 
    $a;
        }
        
        public function 
    __toString() {
            return 
    $this->a;
        }

    }

    class 
    expression {
        
        public function 
    __constructgreeting $asay $b$c ) {
            echo 
    $a $b;
            switch(
    $c) {
                case 
    "exclamation":
                    echo 
    "!";
                    break;
                default:
                    echo 
    ".";            
            }        
        }
        
    }

    new 
    expression(new hello(), new say("World"), "exclamation");

    ?>
    One of the problems many people face when it comes to object oriented programming is the whole notion of an object. Many inexperienced programmers will get carried away and represent an entity as an object when there is no need to (like the exaggerated example above). A few months ago I was a strong advocate of OOP, not because you can use objects, but because of design patterns and the beautiful architectures you can create. However, as WingedPanther pointed out these patterns and architectures can just as easily be implemented procedurally. That being said, I don't prefer either. I use what is right for the job.

  10. #9
    NatalieM's Avatar
    NatalieM is offline Learning Programmer
    Join Date
    Jun 2009
    Location
    London, England
    Posts
    83
    Rep Power
    10

    Re: OOP vs Procedural

    As I'm teaching myself programming, I really like the concept of OOP so I voted for that but at the moment, I mostly do procedural. However, as I'm dreaming up more and more complex programs, I can totally see the power of OOP.

    But even if you love OOP, It seems to me though that procedural programming has a place as OOP can be a bit overkill as some others have pointed out (loved your example John )

  11. #10
    cdg10620's Avatar
    cdg10620 is offline Programming Expert
    Join Date
    Jun 2009
    Location
    Texas
    Posts
    387
    Blog Entries
    3
    Rep Power
    12

    Re: OOP vs Procedural

    OOP is definitely the way to go. Code re-use is a major thing for me. If I can write a method only once and use it in multiple places, that means less work for me.
    -CDG10620
    Software Developer

Closed Thread
Page 1 of 4 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. OOP, procedural programming, etc.
    By jackson6612 in forum C and C++
    Replies: 2
    Last Post: 09-21-2011, 06:13 PM
  2. OOP VS procedural
    By encio in forum Java Help
    Replies: 11
    Last Post: 04-09-2010, 02:17 AM
  3. Which Procedural Language should I use?
    By encio in forum General Programming
    Replies: 1
    Last Post: 04-07-2010, 08:12 AM
  4. In your opinion, is OOP better than procedural programming?
    By DarkLordoftheMonkeys in forum General Programming
    Replies: 6
    Last Post: 11-09-2009, 12:55 AM
  5. Procedural vs OOP
    By John in forum General Programming
    Replies: 5
    Last Post: 08-16-2007, 09:07 AM

Tags for this Thread

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