Académique Documents
Professionnel Documents
Culture Documents
Class Diagram
Provides definition of system components Contains important structural information for the new system
Icon representation
Navigable association
Inheritance association
Bidirectional or Navigable Customer knows about Order and Order knows about Customer
// some methods private void doName() { OrderList = new Order[2]; OrderList[0] = new Order(); OrderList[0].setCustomerName(name); } }
Class Specialization
public class Customer { // some attributes protected String name;
Superclass
Subclasses
public class Commercial : Customer { // some attributes // some methods } public class Consumer : Customer { // some attributes // some methods }
Class Aggregation
Car 1 1 1 Wheel 1..n Engine
Aggregate class
public class Car { // some attributes protected Wheel[] WheelList; protected Engine ClassEngineOject; // some methods }
Parts classes
public class Wheel { // some attributes // some methods } public class Engine { // some attributes // some methods }
Association Class
Association class
public class Shipment { // some attributes public Vendor VendorObject; public Product ProductObject // some methods } public class Vendor { // some attributes protected Product[] ProductList; // some methods } public class Product { // some attributes protected Vendor[] VendorList; // some methods }
Other classes
Sometimes a class needs to provide behavior matching more than one class If the class is already of subclass of another base class then inheritance cant be used so how is this additional behavior guarantee We need a relationship that establishes a contract for one class to implement another's behavior The behavior can be defined with an Interface The Realizes relationship forces the interface to be implemented by the class In this way a class may Realize the behavior of multiple classes
Sub class
public class Window { // some attributes // some methods } public class ListBoxControl : Window, MessageInterface { // some attributes // some methods Boolean receiveMessage(String msg) { // do something } } public interface MessageInterface { // some method signatures Boolean receiveMessage(String msg); }