OOP, Nouns, Verbs And Metaphors

Using nouns and verbs is a good way of introducing OOP. I think it is effective in breaking the mindset of procedural programming and changing the direction of thinking. It is also very effective in explaining some key concepts. However, it is effective only as a way of thinking. There can be problems when we start using it as a design philosophy.

As Buko Obele says, programming is not art. He goes on to show where nouns and verbs can create problems.

The word ‘person’ in a sentence isn’t dependent upon any notion of a particular verb, it always exists prior and apart from the sentence. In practice we would never say that a person who can’t, for example, ‘run’ isn’t a person because ‘person’ is its own word. But in object oriented design precisely the opposite is true: the person type (concept) is defined by its ability to ‘run’ and objects that don’t know to run are strictly not persons. In object oriented design concepts do not exist separately and apart from their methods at all — instead, the whole point is that they are strictly constituted by their methods. So all the talk of subjects and verbs may be a decent way to explain object oriented design but it’s self-evidently the wrong approach to doing object oriented design.

I remember Joshua Porter’s quote, which I think is valid about all designs:

Art is about personal expression, Design is about use.

But a design is useful only within its scope, anywhere outside it goes completely invalid.

The biggest problem is in using the nouns and verbs to map the two languages, that is, the natural language and the programming language. As Buko says, the natural language is full of metaphors and ambiguity and many times without any defined scope, which is of little help in designing software systems. There are lesser bindings, lesser dependencies and capabilities can vary a lot. However, we start tightening bolts when we start to define the scope for our software system. That is the time when we actually redefine, or you can say choose a subset of, the nouns and verbs for our convenience and understanding. We create associations, define capabilities, lifecycles and identify dependencies.

In my opinion nouns and verbs are very effective in identifying in what to do, who does it and catching improper assignment of responsibilities early in the design, but only if the scope is defined. Otherwise it ends up cycles of discussions and redesigns and then frustrations.

Discussion [Participate or Link]

  1. Chipping the web - simple, not secure -- Chip’s Quips said:

    […] on the status of verbs in […]

  2. Nick said:

    I always introduce OO as nouns and verbs. I also disagree with the quote given. As a class we assume that people can run. However the instance may have a method callback that results in a (running, as it were, the metaphor into the ground) crippled exception.

  3. Robert Martim said:

    I disagree with Buko Obele. A class is an entity in the same way a person is an entity and both are independent of the methods or properties that exist around them. “Run” is independent of a person, because it is not a method used only by people.

    I think that the main point here is abstraction. Buko Obele fails to realize that “person” is an abstration in the same way that a bird is. If you ask someone if a tree is concrete or abstract, they will say “concrete”, but it is an abstraction until you define what that tree is. In the same way, a class is an abstraction until you define what it is.

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.



Abhijit Nadgouda
iface Consulting
+91 9819820312
My bookmarks


This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.