Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami

Similar presentations


Presentation on theme: "Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami"— Presentation transcript:

1 Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami
Modified from Sommerville’s originals

2 2 C. Structural Models

3 What is a Domain Model? Use cases looked at the system’s environment (actors) and the system’s external behavior. Use cases consider the system as a black box and help us understand how the system as a whole interacts with the outside word. Now we turn to consider the inside of the system. We do this by building the domain model, which shows what the black box (the system) encloses. uses cases elaborate the system’s behavioral characteristics (sequence of stimulus-response steps), domain model gives details of the systems structural characteristics (system parts and their arrangement) Software Engineering OO Domain Modeling

4 What is a Domain Model? uses cases elaborate the system’s behavioral characteristics (sequence of stimulus-response steps), domain model gives details of the systems structural characteristics (system parts and their arrangement) The next step is to model the inside of the system. We do this by building the domain model, which shows what the black box (the system) encloses. Software Engineering OO Domain Modeling

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

6 Structural Models 4  Structural models of software display the organization of a system in terms of the components that make up that system and their relationships.  You create structural models of a system when you are discussing and designing the system architecture.  Class diagrams used for modeling the static structure of the object classes in a software system.

7 Class Diagram attributes, operations, relationships and behaviors.
5  A class represent a concept.  It is a description of a set of objects having similar attributes, operations, relationships and behaviors.  A class encapsulates state (attributes) and behavior (operations).  The Class Name is the only mandatory information. Class Name Attribute Operation()

8 From Use Cases to: Objects, Attributes, Operations (methods) -“evolutionary ”
Software Engineering OO Domain Modeling

9 Building the Domain Model
A useful strategy for building a domain model is to start with: the “boundary” concepts that interact directly with the actors and then identify the internal concepts Software Engineering OO Domain Modeling

10 Domain Model Relationships
Conceptual Class Diagram Classes, attributes, associations Domain objects Use Case Model Functional Requirements Domain Model Define terms Glossary Interaction Diagrams Dynamic Behavior Software Engineering OO Domain Modeling

11 Steps to create a Domain Model
Identify Candidate Conceptual classes Draw them in a Domain Model Add associations necessary to record the relationships that must be retained Add attributes necessary for information to be preserved Software Engineering OO Domain Modeling

12 Finding Classes 6 Categories to focus when finding represent-able objects:  Tangibles (e.g. classroom, playground).  Conceptual (e.g. course, module).  External Organizations (e.g. publisher, supplier).  Roles Played (student, teacher).  Other System (admission system, grade reporting system).

13 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

14  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

15 Find conceptual classes
Software Engineering OO Domain Modeling

16 Use a category list Finding concepts using the concept category list :
Physical objects: register, airplane, blood pressure monitor Places: airport, hospital Catalogs: Product Catalog Transactions: Sale, Payment, reservation Software Engineering OO Domain Modeling

17 Identifying objects Software Engineering OO Domain Modeling

18 Identifying Operations ‘methods’
Software Engineering OO Domain Modeling

19 Objects Software Engineering OO Domain Modeling

20 Example: Identify conceptual classes from noun phrases
Consider the following problem description, analyzed for Subjects, Verbs, Objects: The ATM verifies whether the customer's card number and PIN are correct. SC V R O O A O A If it is, then the customer can check the account balance, deposit cash, and withdraw cash. S R V O A V O A V O A Checking the balance simply displays the account balance. S M O A V O A Depositing asks the customer to enter the amount, then updates the account balance. M S V O R V OA V OA Withdraw cash asks the customer for the amount to withdraw; if the account has enough cash, S M A O V O R OA V S C V O A the account balance is updated. The ATM prints the customer’s account balance on a receipt. O A V C S V O A O Analyze each subject and object as follows: Does it represent a person performing an action? Then it’s an actor, ‘R’. Is it also a verb (such as ‘deposit’)? Then it may be a method, ‘M’. Is it a simple value, such as ‘color’ (string) or ‘money’ (number)? Then it is probably an attribute, ‘A’. Which NPs are unmarked? Make it ‘C’ for class. Verbs can also be classes, for example: Deposit is a class if it retains state information Software Engineering OO Domain Modeling

21 Mapping parts of speech to object model components [Abbott, 1983]
Part of Speech Model Component Examples Proper noun Instance Ali Common noun Class Student, Customer,.. Doing verb Operation Buy, check,.. Being verb Inheritance Is a kind of, is one of either Having verb Aggregation (Composition) Has, consists of, includes Modal verb Constraints Must be Adjective attributes Attributes 3 years old Software Engineering OO Domain Modeling

22 Example: a typical description
Software Engineering OO Domain Modeling

23 Mapping parts of speech to object model components
Software Engineering OO Domain Modeling

24 Example: Initial POS domain model
SalesLineItem Register Item Store Sale Payment Software Engineering OO Domain Modeling

25 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.

26 Associations Software Engineering OO Domain Modeling

27 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

28 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

29 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(); }; } ;

30 Multiplicity Representation
13

31 Multiple association between two classes
Software Engineering OO Domain Modeling

32 Example: Initial POS domain model
Software Engineering OO Domain Modeling

33 Example: Initial Domain model of the Monopoly Game
Software Engineering OO Domain Modeling

34 Example: Domain model of the Monopoly Game
Software Engineering OO Domain Modeling

35 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

36 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.

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

38 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.

39 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.

40 Generalization 19

41 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.

42 Example: Information System for School
21

43 Software Engineering OO Domain Modeling

44 Software Engineering OO Domain Modeling

45 Software Engineering OO Domain Modeling

46 Software Engineering OO Domain Modeling

47 Software Engineering OO Domain Modeling

48 Class or Attributes Software Engineering OO Domain Modeling

49 Class or Attributes Software Engineering OO Domain Modeling

50 Description Class Software Engineering OO Domain Modeling


Download ppt "Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami"

Similar presentations


Ads by Google