Static Modeling

Identifying Attributes

To find the attributes of a class ask yourself the following questions:

  • What does the class know?
  • What information should be stored by the class?

We will discuss this in further detail below when we develop a domain model.

Developing a Domain Model

For very small business domains, domain model is not required; a glossary of terms will be sufficient. Domain model should only be concerned with the problem domain and should not include anything related to solution domain. The main purpose of the domain model is as a communication tool between the developers and other non-technical staff. This is the reason why we do not include anything related to the solution domain.

The sequence of activities shown in this eBook is for learning purposes only. In real world, OOAD skills that you apply will not be rigid or follow a linear structure.

Identify Classes

Class is a template that defines the structure and behavior of an object. It defines the data (state) and methods (behavior) that all objects of that class will possess.

An object is characterized by responsibilities, semantic integrity constraints, types and relationships. Meriam Webster defines the term semantic as related to meaning. An example of a semantic integrity constraint on a class called Reservation would be Number of rooms reserved cannot be zero or negative. These rules are the constraints on the data values of the object that impose the business rules. From a programming standpoint, you must throw an exception to indicate invalid data passed to the methods in a class. This prevents violation of the data integrity in the system.

To identify classes, make a list of key nouns from use cases. These are candidate classes. Synonyms must be merged into one term and documented.

Classes can be found by using the following categories:

  1. Tangible things (e.g., Book, Apple, Credit card application form)
  2. External systems (i.e., actors, e.g., Credit Bureau)
  3. Devices the system interacts with (library card scanner, receipt printer)
  4. Locations of things (Concert Hall, Exhibit Room)
  5. Roles of people or systems (Teacher, Credit Authorizer)
  6. Organizations (Hospital, Finance department)
  7. Events (signing a lease or shifting a gear)
  8. Remembered events (time of delivery of a package, date of signing a lease)

Identify Attributes of a Class

Find the data that a class needs to maintain its state. The decision whether to represent the data as an attribute or derive it when required depends on speed vs space trade off. E.g., total debts owned to all creditors by a credit counseling service customer.

Keep the data in the class where it is used most of the time. During the triage on the candidate classes, eliminate any classes that provide the functions of a primitive data type such as string etc. It becomes an attribute.

Identify methods

Make a list of all the verbs in the use cases. These become a list of probable methods. Similar to the classes any synonyms must be merged into one term and documented.

We have discussed about identifying responsibilities and attributes in the requirements modeling chapter. This is during the analysis phase, therefore each responsibility of a class may have to mapped on to several methods when we design. The attributes that we found in that chapter are related to the problem domain only.