Jump to content

In your opinion, is OOP better than procedural programming?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
DarkLordoftheMonkeys

DarkLordoftheMonkeys

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
What are the advantages and disadvantages of each?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It depends HEAVILY on the context. As an abstraction mechanism, I find OOP far more useful. For ease of understanding, procedural probably wins. Large chunks of OOP code are actually procedural, in many cases, so they aren't really an either/or situation.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Check out this thread: http://forum.codecal...procedural.html

A lot of good info there on this subject in particular.

#4
DarkLordoftheMonkeys

DarkLordoftheMonkeys

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
I looked at that thread and found a lot of what people were talking about to be familiar. I have used OOP languages (Javascript and Java) in my freelance coding, but most of what I end up doing with those languages is procedural. I only end up ever using objects when those objects are already there, like the document object in Javascript. I rarely end up creating my own objects, and a lot of the facilities of OOP, such as class inheritance, are things that I fail to take advantage of. This may of course be because I've never done anything real large scale, like an application. Mostly I think it boils down to my lack of experience and skill in programming. Right now I'm learning Shell and sed, which are both procedural languages, and I find them to be simpler and easier to learn than OOP, yet still useful. Maybe as my skills increase and I move on to more complex tasks I will be able to tell the difference between a problem to be solved using OOP and a problem to be solved in a procedural way.

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
From the research I've done, OOP doesn't really give you anything until you get to a decently large application.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
JCoder

JCoder

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 245 posts
Yes, advantages of OOP are visible especially in large applications.

However, we do code reviews quite often at our company, and it is amazing how often the "experienced" guys use OOP incorrectly, which leads to worse code than if someone simply disallowed them using implementation inheritance (not multiple inheritance - I mean SINGLE inheritance). I saw inheritance in various places made only because "some method required this object to be a Module, so we made it extend the Module class". So, as with any other high-level concept, it may be sometimes dangerous. That is why for high-level OOP design we generally have separate designers.

It also seems that by OOP most programmers really mean OOP+procedural (e.g. Java or ObjectiveC), but this is not the only possibility. You can also have OOP+functional paradigm (CLOS) or OOP+procedural+functional hybrids (Scala, Groovy, Ruby or JavaFX script). IMHO the statically typed ones from these goup seem to be the most expressive and powerful, though they can be easier abused and require much more responsibility than the OOP+procedural languages. Oh, and there is also a pure OOP paradigm - modelling/simulation languages like VHDL/SPICE are good examples of this.

#7
deathsin

deathsin

    Newbie

  • Members
  • Pip
  • 5 posts
i got used to write every thing in oop no matter how small and simple it is :D