Developing a project involves requirements specification, system analysis, system design, implementation, testing, deployment, and maintenance. The process of designing classes calls for identifying the classes and discovering the relationships among them.
The common relationships among classes are association , aggregation , composition , dependency , and inheritance .
Some guidelines for class design are cohesion , consistency , encapsulation , clarity , and completeness .
A property shared by all the instances of a class should be declared as a static property.
Don't mistakenly overlook static data fields or methods . A method not tied to a specific instance should be declared static.
The difference between inheritance and aggregation is the difference between an is-a relationship and a has-a relationship.
Both interfaces and abstract classes can be used to generalize common features. How do you decide whether to use an interface or a class? In general, a strong is-a relationship that clearly describes a parent “child relationship should be modeled using classes.
Interfaces are more flexible than abstract classes, because a subclass can extend only one superclass but can implement any number of interfaces. However, interfaces cannot contain concrete methods.
Sequence diagrams describe interactions among objects by depicting the time-ordering of method invocations. Statechart diagrams describe the flow of control of an object.