Module 3: Class diagrams
We are now ready to begin our design work. In this context, the concrete artifact of our design work is a model, and for object-oriented design, we use the UML as the language in which we express that model. The static structure of the system is expressed as a set of classes, their operations and attributes, and the relationships between them. This type of diagram, commonly called a class diagram, is the basis of your object-oriented design work. We begin the module by exploring a technique that helps you to first discover the classes that are present in your system, and then move towards how we express their structure and the relationships between them in more precise detail.Lecture material
- Class diagrams :: Powerpoint :: PDF
Tutorial
The tutorial following this lecture should aim to get students started on the creation of class diagrams. To do this, the first phase of the tutorial uses CRC modeling to identify a set of classes with associated responsibilities and collaborators. The scenario being worked on could be one specifically for this tutorial and which is based on a "real life" situation. In the Study Modules, for example, the game of Blackjack is used as a case study. Alternatively, the scenarios and use cases developed in the last tutorial could be used.In the second phase, students should then work on first, drawing the classes, and second, drawing the relations betwen them. They should identify generalization relationship, and then work on adding the "uses" relationships identified as collaborators. Finally, they should refine the associations with multiplicity. To wrap up, they should be offered feedback on what they have so far and be encouraged to keep refining the diagram.
Self-study modules
The first module consists of a series of exercises for developing your skills in finding and modelling objects and classes from a problem domain.
- CRC Modelling and Class Diagrams :: pdf
The second module examines the concepts of inheritance and polymorphism and how to apply them in object-oriented designs. The laboratory exercise then shows how to implement these concepts in Java.
- Inheritance and polymorphism :: pdf
Resources
- Class Responsibility Collaborator (CRC) Models, Scott Ambler
http://www.agilemodeling.com/artifacts/crcModel.htm - UML 2 Class Diagrams, Scott Ambler
http://www.agilemodeling.com/artifacts/classDiagram.htm - UML 2 Class Diagram Guidelines, Scott Ambler
http://www.agilemodeling.com/style/classDiagram.htm - Class diagram, Wikipedia
http://en.wikipedia.org/wiki/Class_diagram