Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Engineering System Modeling Extra examples Dr.Doaa Sami

Similar presentations


Presentation on theme: "Software Engineering System Modeling Extra examples Dr.Doaa Sami"— Presentation transcript:

1 Software Engineering System Modeling Extra examples Dr.Doaa Sami
Modified from Sommerville’s originals

2 2 C. Structural Models

3 3 1. C l a s s D i a g r a m

4 attribute values +getlength(): double
Class Attributes 7  Visibility name : type [count] = default_value  underline static attributes Student  Visibility name: string  +  public totalStudent:int #  protected getName(): string  -  private getTotalStuden()t:int  /  derived  derived attribute: not stored, length: double -width:double attribute values getlength(): double +getArea(): double - salary: double + getSalary(): double Rectangle /area:double but can be computed from other +getWidth():double

5  Visibility -name: string
Class Operations 8  Visibility name (parameters) : return_type  underline static operations Student  Visibility name: string  +  public totalStudent:int  # protected getName(): string  -  private getTotalStuden()t:int return_type is omitted if function is: Rectangle  constructor length: double  void width:double +getlength(): double +getWidth():double +getArea():double - salary: double + getSalary(): double /area:double

6 Relationships 9  There are two kinds of Relationships
 Association (student enrolls in course).  Generalization (parent-child relationship).  Associations can be further classified as  Aggregation.  Composition.

7 Association  Associations denote relationships between classes.
10  Associations denote relationships between classes.  Describe the nature of the relationship.  Example:  Student enrolls into course  Course enrolled by a student. Student Course Enrolls

8 Multiplicity relates to ONE instance of another class.
11  Multiplicity is the number of instances one class relates to ONE instance of another class.  For each association, there are two multiplicity decisions to make, one for each end of the association.  For each instance of Professor, many Sections may be taught.  For each instance of Section, there may be either one or zero Professor as the instructor. Professor Section -name:string has * -section#:int +getName():string getSection#:int

9 Multiplicity (C++ Implementation)
12 Professor Section -name:string has * -section#:int +getName():string getSection#:int class Professor{ class Section{ // A list of Sections // Proffessor Section sec[4]; Professor prof; string name; int sectionNum; Public: Public: string getName(); int getSectionNum(); }; } ;

10 Multiplicity Representation
13

11 Aggregation models a whole-part relationship between an
14 Association is used when both of the involved classes are equaly important.  Aggregation is a special form of association that models a whole-part relationship between an aggregate (the whole) and its parts.  Aggregation shows how classes that are collections are composed of other classes.  Aggregation is a part-of relationship. Car Wheel

12 Composition 15  Composition is a strong form of aggregation.
 Aggregation is used to model a whole-part relationship between an aggregate (whole) and its parts.  Composition is a strong form of aggregation.  The whole is the only owner of its part.  Multiplicity on the whole side must be one.  The lifetime of the part is dependent upon the whole.  When Circle is destroyed, Point is also destroyed.  The composite must manage the creation and destruction of its parts.

13 Composition (C++ Implementation)
16 Restaurant Menu class Restaurant{ class Menu{ }; Menu m; }; ....

14 Generalization Cows and Wolfs are Mammals. 17
Rather than learn the detailed characteristics of every entity that we experience, we place these entities in more general classes (animals, cars, houses, etc.) and learn characteristics of these classes.  This allows us to infer that different members of these classes have some common characteristics e.g. Cows and Wolfs are Mammals.

15 Generalization Cont. 18  In object-oriented languages, generalization is implemented using class inheritance mechanisms.  In a generalization, the attributes and operations associated with higher-level classes (super classes) are also associated with the lower-level classes (sub classes).  Subclasses are inherit the attributes and operations from their Superclasses and then add more specific attributes and operations.

16 Generalization 19

17 Association Class association connection to have operations and
20  An association class is a construct that allows an association connection to have operations and attributes.  It used when you need to include another class because it includes valuable information about the relationship.

18 Example: Information System for School
21


Download ppt "Software Engineering System Modeling Extra examples Dr.Doaa Sami"

Similar presentations


Ads by Google