A Designer is provided with the following statement of requirements by their customer, amongst a larger set of requirements :
The company has multiple warehouses, and each has location (street address) and a manager. Each product has a bar-code and products can be stored in a warehouse, removed from a warehouse or transferred between warehouses. Each product has a specific location (floor/shelf) within each warehouse.
Based on this single statement, which of the following describes a reasonable initial design :
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The best way to do at least a first pass on OOP Analysis is to scan through the sentences and underline the words and double underline the verbs. Nouns are candidates for your object classes, and the verbs are candidates for methods.
In our example then we have many nouns (warehouse, bar-code, address), so you now need to asses whether one noun represents something that is related to one of the other nouns - for instance a bar-code is related to a product, and an address is related to a warehouse, and there is no direct relationship between a bar-code and a warehouse (for instance). You can probably write these relationships in terms of :
When you have all of the relationships written down, the nouns on the left side are good candidate for classes and those on the right side are good candidates for attributes or properties of the noun on the left hand side.
With your list of verbs/methods - look at your sentences to see which nouns those verbs act on - that will give you a clue as to which classes these methods apply to. Don't stop with just one sentence - go through each sentence, work out the best class/attribute/method design that will satisfy your requirements.
It is very rare that there is only one right design.