Is OO design's strength in semantics or encapsulation?

Posted by Phil H on Stack Overflow See other posts from Stack Overflow or by Phil H
Published on 2009-03-21T09:36:59Z Indexed on 2010/05/29 0:52 UTC
Read the original article Hit count: 363

Object-oriented design (OOD) combines data and its methods. This, as far as I can see, achieves two great things: it provides encapsulation (so I don't care what data there is, only how I get values I want) and semantics (it relates the data together with names, and its methods consistently use the data as originally intended).

So where does OOD's strength lie? In constrast, functional programming attributes the richness to the verbs rather than the nouns, and so both encapsulation and semantics are provided by the methods rather than the data structures.

I work with a system that is on the functional end of the spectrum, and continually long for the semantics and encapsulation of OO. But I can see that OO's encapsulation can be a barrier to flexible extension of an object. So at the moment, I can see the semantics as a greater strength.

Or is encapsulation the key to all worthwhile code?

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about object-oriented-design