Presentation is loading. Please wait.

Presentation is loading. Please wait.

OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences.

Similar presentations


Presentation on theme: "OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences."— Presentation transcript:

1 OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences Department of Computer Science Dr. Doaa Sami Khafaga

2 Objectives The main objective of this chapter is to know: how to properly use the most essential features of UML class diagrams, and the typical problems you will encounter when modeling with class diagrams. In this chapter we: ● Introduce the evolutionary approach for building classes ● Explain how to identify objects and attributes of classes ● Describe the technique of CRC ‘Class Responsibility and Collaborator’ ● Explain how classes are related in a class diagram ● Explain generalization, association, aggregation and composition ● Introduce object diagrams S.H 2009 Software EngineeringOO Domain Modeling

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) S.H 2009 Software EngineeringOO 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. S.H 2009 Software EngineeringOO Domain Modeling

5 What is a Domain Model? ● Illustrates meaningful concepts in the problem domain. ● Usually expressed in the form of static diagrams (in Rational this implies a high-level class diagram). ● Is a representation of real-world things; not software components (of the system under development). ● No operations are defined or specified in the conceptual model. ● Should show concepts, associations between concepts, and attributes of concepts. ● Serves as a source of software objects. S.H 2009 Software EngineeringOO Domain Modeling

6 What is a Domain Model? Objectives ● identify concepts related to current development cycle requirements ● create initial conceptual model ● Identify attributed ● add specification concepts S.H 2009 Software EngineeringOO Domain Modeling

7 What is a Domain Model? S.H 2009 Software EngineeringOO Domain Modeling

8 What constitutes a good model? A model should ● use a standard notation ● be understandable by clients and users ● lead software engineers to have insights about the system ● provide abstraction. Models are used: ● to help create designs ● to permit analysis and review of those designs ● as the core documentation describing the system. S.H 2009 Software EngineeringOO Domain Modeling

9 From Use Cases to: Objects, Attributes, Operations (methods) -“evolutionary ” S.H 2009 Software EngineeringOO Domain Modeling

10 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 S.H 2009 Software EngineeringOO Domain Modeling

11 Domain Model Relationships Domain Model Interaction Diagrams Dynamic Behavior Conceptual Class Diagram Classes, attributes, associations Domain objects Use Case Model Functional Requirements Define terms Glossary S.H 2009 Software EngineeringOO Domain Modeling

12 Steps to create a Domain Model Steps ● 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 S.H 2009 Software EngineeringOO Domain Modeling

13 Find conceptual classes S.H 2009 Software EngineeringOO Domain Modeling

14 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 S.H 2009 Software EngineeringOO Domain Modeling

15 Identify conceptual classes from noun phrases ● Finding concepts using Noun Phrase identification in the textual description of the domain. ● Noun phrases may also be attributes or parameters rather than classes: ● If it stores state information or it has multiple behaviors, then it’s a class ● If it’s just a number or a string, then it’s probably an attribute S.H 2009 Software EngineeringOO Domain Modeling

16 Identifying objects S.H 2009 Software EngineeringOO Domain Modeling

17 Identifying Operations ‘methods’ S.H 2009 Software EngineeringOO Domain Modeling

18 Objects S.H 2009 Software EngineeringOO Domain Modeling

19 Example: Identify conceptual classes from noun phrases Consider the following problem description, analyzed for Subjects, Verbs, Objects: S.H 2009 Software EngineeringOO Domain Modeling The ATM verifies whether the customer's card number and PIN are correct. S C V R OO A O A If it is, then the customer can check the account balance, deposit cash, and withdraw cash. S R VO A VO A VO A Checking the balance simply displays the account balance. S M O A VO A Depositing asks the customer to enter the amount, then updates the account balance. M SVO R VO A VO A Withdraw cash asks the customer for the amount to withdraw; if the account has enough cash, S M A OVO R O A VS C VO A the account balance is updated. The ATM prints the customer’s account balance on a receipt. O A V C SVO 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

20 Mapping parts of speech to object model components [Abbott, 1983] S.H 2009 Software EngineeringOO Domain Modeling Part of SpeechModel ComponentExamples Proper nounInstanceAli Common nounClassStudent, Customer,.. Doing verbOperationBuy, check,.. Being verbInheritanceIs a kind of, is one of either Having verbAggregation (Composition) Has, consists of, includes Modal verbConstraintsMust be Adjective attributesAttributes3 years old

21 Example: a typical description S.H 2009 Software EngineeringOO Domain Modeling

22 Mapping parts of speech to object model components S.H 2009 Software EngineeringOO Domain Modeling

23 Identify conceptual classes from noun phrases: POS ● Examine use case descriptions. ● Example: Process Sale use case: ● Main success scenario: ● Customer arrives at a POS checkout counter. ● Cashier starts a new sale. ● Cashier enters an item ID. ● System records sale line item. It then presents a description of the item, its price, and a running total. ● …. ● Possible source of confusion: Is it an attribute or a concept? ● If X is not a number or a text then it probably is a conceptual class. S.H 2009 Software EngineeringOO Domain Modeling

24 Example: Initial POS domain model S.H 2009 Software EngineeringOO Domain Modeling SalesLineItem Item Sale Register Store Payment

25 Class and Class diagram Class naming: Use singular names because each class represents a generalized version of asingular object. Class diagrams are at the core of OO Engineering. Things naturally fall into categories (computers, automobiles, trees...). We refer to these categories as classes. An object class is an abstraction over a set of objects with common: attributes (states) and the services (operations) (methods) provided by each object Class diagrams provide the representations used by the developers. S.H 2009 Software EngineeringOO Domain Modeling

26 Example: Initial POS domain model S.H 2009 Software EngineeringOO Domain Modeling

27 Example: Initial Domain model of the Monopoly Game S.H 2009 Software EngineeringOO Domain Modeling

28 Example: Domain model of the Monopoly Game S.H 2009 Software EngineeringOO Domain Modeling

29 Agile modeling style S.H 2009 Software EngineeringOO Domain Modeling

30 S.H 2009 Software EngineeringOO Domain Modeling

31 S.H 2009 Software EngineeringOO Domain Modeling

32 S.H 2009 Software EngineeringOO Domain Modeling

33 S.H 2009 Software EngineeringOO Domain Modeling

34 S.H 2009 Software EngineeringOO Domain Modeling

35 S.H 2009 Software EngineeringOO Domain Modeling

36 S.H 2009 Software EngineeringOO Domain Modeling

37 S.H 2009 Software EngineeringOO Domain Modeling

38 Class or Attributes S.H 2009 Software EngineeringOO Domain Modeling

39 Class or Attributes S.H 2009 Software EngineeringOO Domain Modeling

40 Description Class S.H 2009 Software EngineeringOO Domain Modeling

41 Associations S.H 2009 Software EngineeringOO Domain Modeling

42 Associations S.H 2009 Software EngineeringOO Domain Modeling

43 Association, aggregation and composition S.H 2009 Software EngineeringOO Domain Modeling

44 Association between classes Who does What S.H 2009 Software EngineeringOO Domain Modeling

45 When to show association S.H 2009 Software EngineeringOO Domain Modeling

46 Associations and implementation S.H 2009 Software EngineeringOO Domain Modeling

47 Association Notation S.H 2009 Software EngineeringOO Domain Modeling

48 Association Notation S.H 2009 Software EngineeringOO Domain Modeling

49 Naming association S.H 2009 Software EngineeringOO Domain Modeling

50 Applying UML: multiplicity S.H 2009 Software EngineeringOO Domain Modeling

51 Multiplicity values S.H 2009 Software EngineeringOO Domain Modeling

52 Applying UML: multiplicity S.H 2009 Software EngineeringOO Domain Modeling

53 Applying UML: multiplicity S.H 2009 Software EngineeringOO Domain Modeling

54 Multiple association between two classes S.H 2009 Software EngineeringOO Domain Modeling

55 Find association S.H 2009 Software EngineeringOO Domain Modeling

56 Find association ● High priority associations ● A is a physical or logical part of B ● A is physically or logically contained in/on B ● A is recorded in B ● Other associations ● A uses or manages or controls B (Pilot -airplane) ● A owns B (Airline -airplane) ● Each of the two ends of an association is called a role. Roles have ● name ● multiplicity expression ● navigability S.H 2009 Software EngineeringOO Domain Modeling

57 Example: POS Domain Model S.H 2009 Software EngineeringOO Domain Modeling

58 Example: Monopoly Game Partial Domain Model S.H 2009 Software EngineeringOO Domain Modeling

59 Attributes ● Attribute - is a logical data value of an object ● Include the following attributes in a conceptual model ● those for which the requirements suggest or imply a need to remember information ● For example: ● Sale needs a dateTime attribute ● Store needs a name and address. S.H 2009 Software EngineeringOO Domain Modeling

60 Attributes: UML Notation S.H 2009 Software EngineeringOO Domain Modeling

61 Suitable attribute types S.H 2009 Software EngineeringOO Domain Modeling

62 Data types as attributes S.H 2009 Software EngineeringOO Domain Modeling

63 Attributes are NOT foreign keys S.H 2009 Software EngineeringOO Domain Modeling

64 Generalization S.H 2015 Software EngineeringOO Domain Modeling


Download ppt "OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences."

Similar presentations


Ads by Google