OOP - it's not perfect

March 13th, 2009

Ok, not trying to start a flame war but, I’m republishing this, it was from an interview with Rob Pike (works for google, really smart, had his hands in the early days of Unix). This is a great response to a question posed to him and for the record the original article is here Rob Pike Responds but, I am just publishing one part of it. I’d encourage you to read it as we should always try to solve a problem the best way possible and that is what this is about.

Question Hello!

Maybe this is an overly-asked question, but I still often ponder it. Does object-oriented design negate or diminish the future prospects of Unix’s continuing popularity?

I’ve developed in C (which I still love), but lately, I’ve been doing a lot of purely object-oriented development in Java. Using things like delegation and reusable classes have made life so much easier in many respects. Since the *nixes are so dependent upon C, I was wondering what future you see in C combined with Unix. Like I said, I love C and still enjoy developing in Unix, but there has to be a point where you build on your progress and the object-oriented languages, in my opinion, seem to be doing that.

Thank you for all your contributions!!!


The future does indeed seem to have an OO hue. It may have bearing on Unix, but I doubt it; Unix in all its variants has become so important as the operating system of the internet that whatever the Java applications and desktop dances may lead to, Unix will still be pushing the packets around for a quite a while.

On a related topic, let me say that I’m not much of a fan of object-oriented design. I’ve seen some beautiful stuff done with OO, and I’ve even done some OO stuff myself, but it’s just one way to approach a problem. For some problems, it’s an ideal way; for others, it’s not such a good fit.

Here’s an analogy. If you want to make some physical artifact, you might decide to build it purely in wood because you like the way the grain of the wood adds to the beauty of the object. In fact many of the most beautiful things in the world are made of wood. But wood is not ideal for everything. No amount of beauty of the grain can make wood conduct electricity, or support a skyscraper, or absorb huge amounts of energy without breaking. Sometimes you need metal or plastic or synthetic materials; more often you need a wide range of materials to build something of lasting value. Don’t let the fact that you love wood blind you to the problems wood has as a material, or to the possibilities offered by other materials.

The promoters of object-oriented design sometimes sound like master woodworkers waiting for the beauty of the physical block of wood to reveal itself before they begin to work. “Oh, look; if I turn the wood this way, the grain flows along the angle of the seat at just the right angle, see?” Great, nice chair. But will you notice the grain when you’re sitting on it? And what about next time? Sometimes the thing that needs to be made is not hiding in any block of wood.

OO is great for problems where an interface applies naturally to a wide range of types, not so good for managing polymorphism (the machinations to get collections into OO languages are astounding to watch and can be hellish to work with), and remarkably ill-suited for network computing. That’s why I reserve the right to match the language to the problem, and even – often – to coordinate software written in several languages towards solving a single problem.

It’s that last point – different languages for different subproblems – that sometimes seems lost to the OO crowd. In a typical working day I probably use a half dozen languages – C, C++, Java, Python, Awk, Shell – and many more little languages you don’t usually even think of as languages – regular expressions, Makefiles, shell wildcards, arithmetic, logic, statistics, calculus – the list goes on.

Does object-oriented design have much to say to Unix? Sure, but no more than functions or concurrency or databases or pattern matching or little languages or….

Regardless of what I think, though, OO design is the way people are taught to think about computing these days. I guess that’s OK – the work does seem to get done, after all – but I wish the view was a little broader.

1 Response to “OOP - it's not perfect”

  1. Steven Alig Says:

    And I thought you went from “hip designer” to “computer geek” when you got your first PDA back at GoCruiseDirect.com But this post so confirms it!!! :)

    BTW – I agree with the post and will add that most programmers only sell what they know. They may be so passionate about OO because they dont know anything else.

    Regards, Fellow Computer Geek

Leave a Reply