Hari's Corner

Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and then

Article on Object Oriented Programming I found interesting

Filed under: Software and Technology by Hari
Posted on Thu, Aug 6, 2009 at 20:58 IST (last updated: Thu, Aug 6, 2009 @ 21:21 IST)

For a long time as a part-time, hobbyist programmer I disliked object-oriented programming as a concept, but I couldn't really put my finger on one single aspect of it that I could point out as a cause for my annoyance/irritation with it.

I think this obscure article really captures my own feelings in a crystallized way:

Modeling the Real World (and read the other articles linked within as well)

The Noun vs. Verb-centric discussion is a really interesting subject in itself, as are forced abstractions. These are the two aspects discussed in the above article that really clinch the issue. I personally think that pure OOP introduces far more ambiguities in the "which method belongs to which class/object" than is worth the miniscule increase in structure or productivity.

Far too often in writing object-oriented programs, one runs into the dilemma of choosing the best way to share common data (which is very frequently encountered in most practical computing problems) between two unrelated classes and also deciding which class should "control" the data. An artificial complexity is created and even justified where none should exist at all.

In my book, a mixture of procedural programming with heavily isolated objects for specific purposes rocks for the simple reason that it is less verbose and more productive, and simply more fun for a hobbyist/non-professional programmer than wasting time and effort on "modelling" problems in pure OOP.

3 comment(s)

  1. I've been reading your blog for a while now, and this article inspired me to write a post on my blog, about the same topic. It pretty much differs from your opinion(s), but I would say that it's worth reading anyway: http://www.petarpetrovic.com/2009/08/on-object-oriented-programming/

    Comment by Petar Petrovic (visitor) on Tue, Aug 11, 2009 @ 22:00 IST #
  2. Hi, Petar,

    My biggest criticism of OOP is that it doesn't even model computer problems well in many cases as the original article linked to says. We think in terms of "verbs" and not "nouns" and so artificially trying to force ownership of actions on objects is a big minus in OOP. In most cases the "verbs" are often distinct in themselves and don't belong to any 'noun'. The simplest example is the binary operation "+"

    a = b + c


    In OOP, the + will have to belong to either a or b. like

    c = a.add (b)

    or simply
    a.add (b)


    Also the fact that in practical computer problems, program data is often shared between segments of unrelated code and using objects forces you to come up with unnecessarily complex solutions for simple tasks or simply go off the OOP paradigm and embrace globals.

    So I think that many of the abstractions of OOP are forced and contrived.

    The code-reuse part is highly over-rated. Components will always be re-usable whether OOP or not, if they are built for the purpose of re-usability.

    Comment by Hari (blog owner) on Tue, Aug 11, 2009 @ 22:33 IST #
  3. Well your article is really very interesting and helpful for all computer science students.I like such post when people like you helps others by blogging.Thanks for sharing.

    Comment by cheap r4 card (visitor) on Wed, Feb 3, 2010 @ 16:01 IST #

Comments closed

The blog owner has closed further commenting on this entry.