Here’s why I don’t do Object Oriented Programming

Ok, a bit of an exaggeration, but I bet I can make one...All else being equal, if a developer candidate tells me they know how to develop with object oriented programming methods but prefer procedural or functional development – they’re getting the job.

What they don’t need to tell me is that they probably learned the hard way, just like I did, that object oriented development is unjustifiably complex.

Some of the greatest minds in computer science today seem to agree.

“Object-oriented programming, whose essence is nothing more than programming using data with associated behaviors, is a powerful idea. It truly is. But it’s not always the best idea. … Sometimes data is just data and functions are just functions.”

Rob Pike

This is really what got me.  It *sounds* good when OOP is pitched.  It’s “reusable”, they say.  Well, it’s really not past two levels – in which case I probably could have just used a function.  If you need one thing, you also need its parent, that parent’s parent, and so on.  I became a bit frustrated with OOP when what I needed was a to reuse something I built to pour a glass of water — so I asked for water and realized I needed to get the local plumber to get the city piping folks to get the filtration plant designs just to make sure it was ok for me to get a glass of water.

And from one of the pioneers of OOP:

“I invented the term object-oriented, and I can tell you I did not have C++ in mind.” and “Java and C++ make you think that the new ideas are like the old ones. Java is the most distressing thing to happen to computing since MS-DOS.”

Allen Kay (from a Georgia Tech talk)

If, rather than my own experience, (I abandoned early after I found the inheritance problem) you’d like to hear from someone who stuck with it a bit longer, try this: Goodbye, Object Oriented Programming where all three main selling points of OOP are pretty well destroyed.

Here’s something worth a watch from PyCon2012:

 

One of the main things I’ve learned as a developer is to be kind to your future self.  You might have to edit this thing two, five, or ten years down the road – long after you’ve forgotten *why* you did the things you did.

I’d greatly prefer simple code wherever possible and that is a style that will stay with me for the rest of my career.