OO Design

 

Betrand Meyer, in his wonderful book Object-Oriented Software Construction, suggests that we do not get too hung up about analyzing sentences. He says that in some cases it can be misleading.

 

For example, consider part of the requirements for the software to control an elevator:

 

 A log item must be created every time that the elevator moves from one floor to another.

 

From this we would conclude that we need objects to represent a log item, an elevator and a floor. But this would be to miss what might be another important object – a move – that appears only as a verb in the requirement. But suppose that the statement was written in this alternative fashion:

 

A log item must be created for every move the elevator from one floor to another.

 

Now the word move is a noun and becomes a candidate for an object.

 

We conclude that putting too must trust in the exact wording of a specification could be misleading.