Skill-Building Exercises


Summary

There are two types of complexity: conceptual and physical. Conceptual complexity is managed by using object-oriented concepts and expressing your object-oriented designs in the Unified Modeling Language (UML). Physical complexity can be managed by your IDE or with an automated build tool such as Ant. You can also manage physical complexity on a small scale by organizing your source files into project directories and compiling multiple files simultaneously using the javac compiler tool.

A dependency is a relationship between two classes in which a change to the depended-upon class will affect the dependent class. An association is a peer-to-peer structural link between two classes.

An aggregation is a special type of association between two objects that results in a whole/part relationship. There are two types of aggregation: simple and composite. The type of aggregation is determined by the extent to which the whole object controls the lifetime of its part objects. If the whole object simply uses the services of a part object but does not control its lifetime then it’s a simple aggregation. On the other hand, if the whole object creates and controls the lifetime of its part objects then it is a composite aggregate.

The UML class diagram can be used to show aggregation associations between classes. A hollow diamond is used to denote simple aggregation and expresses a “uses” or “uses a” relationship between the whole and part classes. A solid diamond is used to show composite aggregation and expresses a “has” or “has a” relationship between whole and part classes.

Sequence diagrams are a type of UML diagram used to graphically illustrate a sequence of system events. Sequence event participants can be internal system objects or external actors. Sequence diagrams do a good job of illustrating the complex message passing between objects that participate in a compositional design.

The Engine class is a composite aggregate. Its behavior is dictated by the behavior of its contained part class objects. Its part classes include Compressor, FuelPump, OilPump, OxygenSensor, and TemperatureSensor.

All the classes in the aircraft simulation use the functionality of the PartStatus class. The PartStatus class employs the typesafe enumeration design pattern. Use the typesafe enumeration design pattern when you want the compiler to perform state-value assignment validation.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net