Partilhar via


A classical abuse of object orientation: Modeling the real world

From time to time, I hear someone saying that object orientation is about “modeling the real world”. I remember repeating this very same idea in my first year of experience with objects, it “feels” very good after all.

 

The phrase conveys good intentions, and depending of your database design experience perhaps you won’t find something wrong with it.

 

The good intention in that phrase is that you should design your software with expressiveness, close to the application domain concepts and business rules.

 

The bad in the phrase is that the goodness in the previous paragraph gets buried in a silly practice that doesn’t take-off from verbs to methods and nouns to class types.

 

Bottom line, modeling “the real world” is one of the most ambiguous and vague phrases I have heard, it is almost equal to say nothing at all. What exactly is the “real world”? There are possible answers as the number of human beings on the face of the earth.

 

Do you see the harm?

 

First and second generation object design methods usually emphasizes data structures (state) or algorithms (behavior), depending if the method comes from a database design background or not. Third generation object design methods put equal emphasis to those aspects plus an emphasis on usage of the software, which makes a lot of sense, because helps to connect the models to the purpose of the thing being modeled. Most object design methods consider physical, logical, static, dynamic and functional aspects in software design; modeling “the real world” simply ignores those aspects of practical design.

 

The harm in modeling “the real world” often consists of an amputation of very important design properties like time and space efficiency, management of dependencies, economy of expression and scalability.

 

I enjoy Robert C. Martin posts because, among other things, he touches sensible aspects of software development in the trenches, aspects many of us have experienced or witnessed as an abuse within projects where customers gain their opinion of our industry:

 

Modelling the real world

https://www.artima.com/weblogs/viewpost.jsp?thread=37870