Tuesday, July 13, 2010

A note about OOP reusability

I was reading the first chapter of the book Practical Clojure, when I found this paragraph comparing OOP code vs. Functional Programming code:

"It [OOP] encourages a high degree of ceremony and code bloat. Simple functionality in Java can require several interdependent classes. Efforts to reduce close coupling through techniques like dependency injection involve even more unnecessary interfaces, configuration files, and code generation. Most of the bulk of a program is not actual program code, but defining elaborate structures to support it."

Which takes me back to my thoughts about all the verbosity of OOP code vs. say Haskell code. If we need so many things to make OOP code work or produce something useful, then are we sure this is the right programing paradigm?


Unknown said...

surely dont or at least dont for all programming contexts

but i think the root issue of (too much) oop is not only the accidental complexity but the way it models your mind: identity, time, model of the world

I think the key is from Rich Hickey:
http://clojure-log.n01se.net/date/2010-04-21.html#i28 (really impressive chat session)

Alvaro said...

Thanks for the links, I'm just going through the Clojure books, to see what it has to offer. I will take a look at those sites, thanks again

Unknown said...

OOP is trying to reinvent maths, the ugly way.

Unknown said...

It's true OOP becomes overbloated very quickly.

I believe that the key reason for this is a simple fact that it's too hard to design a big system for OOP. It's unnatural for programmers to think in terms of OOP architecture.

The end result is that we are stuck in an endless cycle of refactoring by adding a new interfaces on top of existing ones to make code more reusable.

For me we do more abstractions because of poor design choices. OOP programmer is his own best gravedigger.

Verdict : don't blame the programmer. OOP is just made of fail.

Anonymous said...

First let me read this book and then will get back to you..I don't like to answer unless i know more about it! thanks

PHP Developer Job description