TK2023 Object-Oriented Software Engineering CHAPTER 5 DOMAIN MODELLING.

Slides:



Advertisements
Similar presentations
Object Design Examples with GRASP
Advertisements

©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System modeling 2.
Jan 16, Ron McFadyen1 Ch 9. Use-case model: drawing System Sequence Diagrams Iteration 1: a simple cash-only success scenario of Process Sale.
1 SWE Introduction to Software Engineering Lecture 13 – System Modeling.
Copyright ©2004 Cezary Z Janikow 1 Domain Model n Visualization of entities and relationships n In UP presented as Class Diagrams – Classes, Relationships,
Chapter 9 DOMAIN MODELS Objectives
1 Domain Model Adding Associations Chapter 11 Applying UML and Patterns -Craig Larman.
6/8/991 Analysis Tuesday 09/14/99 Revised: September 11, 2000 (APM)
Domain model: visualizing concepts
NJIT 1 Domain Model Visualizing Concepts Chapter 9 Applying UML and Patterns Craig Larman.
Chapter 9 Domain Models 1CS6359 Fall 2012 John Cole.
9/18/011 Software Requirements Analysis and Design (Continued)
Domain Modeling Chandan R. Rupakheti and Steve Chenoweth Week 5, Day 1.
How to Make a Domain Model Tutorial
Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative Development Part III Elaboration Iteration I – Basic1.
Chapter 9 Domain Models. Domain Model in UML Class Diagram Notation A “visual dictionary”
Object-Oriented Analysis and Design
What is a domain model? “A domain model captures the most important types of objects in the context of the business. The domain model represents the ‘things’
Last lecture. What is a Use Case Use cases are stories (scenarios) of how actors use (interact with) the system to fulfill his goal. Examples Process.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Information Systems Analysis and Design Class Modeling
DOMAIN MODEL— PART 2: ATTRIBUTES SYS466. Looking For Potential Classes “Know the business”. Ask Questions Identify business concepts; filter nouns (person,
Chapter 9 Domain Models. Domain Modeling After you have your requirements you start modeling the domain. You are still modeling the business, not the.
Domain Modelling Presented By Dr. Shazzad Hosain.
Sept Ron McFadyen1 Section 10.1 Domain Models Domain Model: a visual representation of conceptual classes or real-world objects in a domain.
DOMAIN MODE: ASSOCIATIONS, MULTIPLICITY AND ATTRIBUTE-TEXT NOTATION SYS466.
Chapter 9 Domain Models $PH\06f522\LarmanApplUMLandPtrns\larman3EdDgmsCh01-14\09_domainModelsR2.ppt – RJL
Review ♦ System sequence diagram ♦ Domain model
Lecture 9 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
Jan 21, Ron McFadyen1 Ch 10. Domain Model: Visualizing Concepts Domain model illustrated with a class diagram (with no operations defined)
Conceptual Modeling Modeling the Problem Domain. Conceptual Modeling Decompose problem space into comprehensible concepts. Clarify the terminology or.
DOMAIN MODEL- VISUALIZING CONCEPTS Identify conceptual classes related to the current iteration requirements. Create an initial domain model. Distinguish.
Lecture 13-17, chitkara university.  Gives a conceptual framework of the things in the problem space  Helps you think – focus on semantics  Provides.
Chapter 9 Applying UML and Patterns -Craig Larman
Domain Model—Part 3: Associations, Multiplicity and Attribute- Text Notation.
SYS466: Analysis and Design Using OO Models Domain Class Diagram.
Lecture 6: Structural Modeling
Conceptual Model or Domain Models Chapter10 Applying UML and pattern.
Chapter 1 Applying UML and Patterns. The Need for Software Blueprints Knowing an object-oriented language and having access to a library is necessary.
Elaboration Iteration 1- Part 1
BTS430 Systems Analysis and Design using UML Domain Model—Part 2: Associations and Attributes.
Domain Model—Part 2: Attributes.  A logical data value of an object  (Text, p. 158)  In a domain model, attributes and their data types should be simple,
Repetition af Domæne model. Artifact influence emphasizing the Domain Model.
DOMAIN MODEL: ADDING ATTRIBUTES Identify attributes in a domain model. Distinguish between correct and incorrect attributes.
BTS430 Systems Analysis and Design using UML Domain Model—Part 2: Associations and Attributes.
BTS430 Systems Analysis and Design using UML Domain Model—Part 2A: Attributes.
January Ron McFadyen1 Domain Models Domain Model: a visual representation of conceptual classes or real-world objects in a domain of interest.
Chapter 9: Domain Models.  The problem domain is modelled using a UML domain model: This is the first OO model that we will see (Use Cases are very useful.
Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects.
BTS430 Systems Analysis and Design using UML Domain Model—Part 2: Associations and Attributes.
Larman chapter 101 Domain Model: Visualizing concepts Larman chapter 10.
OO Methodology Elaboration Phase Iteration 1- Part 3.
1 Chapter 9: Operation Contracts Chapter 13 in Applying UML and Patterns Book.
1 Object Oriented Analysis and Design Conceptual Model.
OO DomainModeling With UML Class Diagrams and CRC Cards Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences.
1 Chapter 9: Conceptual Model Chapter 10, 11 & 12 in Applying UML and Patterns Book.
DOMAIN MODEL—PART 2: ATTRIBUTES BTS430 Systems Analysis and Design using UML.
Laurea Triennale in Informatica – Corso di Ingegneria del Software I – A.A. 2006/2007 Andrea Polini XIV. From Requirements to Design in the UP.
Elaboration popo.
Chapter 9 Domain Models.
Domain Model: Visualizing concepts
Conceptual Model.
DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS
OO Domain Modeling With UML Class Diagrams and CRC Cards
OO Domain Modeling With UML Class Diagrams and CRC Cards
Group Members Muhammad Zeeshan ( 16) Adnan Akhtar (4)
Object Oriented Analysis and Design Conceptual Model.
Object Oriented Analysis
Domain Model: Visualizing Concepts
Design Model: Creating Design Class Diagrams
Presentation transcript:

TK2023 Object-Oriented Software Engineering CHAPTER 5 DOMAIN MODELLING

INTRODUCTION One of the steps in object-oriented analysis is the decomposition of a domain of interest into individual conceptual classes or objects (real- world objects). An important artifact created in this step is a domain model (also known as conceptual model, domain object model and analysis object model).

DOMAIN MODELS A domain model is a visual representation of conceptual classes or real-world objects in a domain of interest. In UML, a domain model is illustrated with a set of class diagrams in which no operations are defined. It shows: conceptual classes (concepts / domain objects) associations between conceptual classes attributes of conceptual classes

Register Item Store address name Sale date time Payment amount Sales LineItem quantity Stocked-in * Houses 1.. * Contained-in 1.. * Records-sale-of 0..1 Paid-by Captured-on  concept or domain object association attributes

DOMAIN MODEL - A VISUAL DICTIONARY OF ABSTRACTIONS Note that the diagram in the previous slide depicts an abstraction of the conceptual classes; details which are uninteresting to the modellers are ignored in the diagram. The visual makes it easy to comprehend the discrete elements and their relationships. Thus, the domain model may be considered a visual dictionary of abstractions of the domain.

DOMAIN MODELS DO NOT SHOW SOFTWARE COMPONENTS A domain model is a visualization of things in the real-world domain of interest, not of software classes. The following elements are not suitable in a domain model:  software artifacts  responsibilities or methods Sale date print() POSApplet

IDENTIFYING CONCEPTUAL CLASSES In iterative development, a domain model is incrementally built over several iterations in the elaboration phase. In each iteration, the domain model is limited to the prior and current scenarios under consideration. It is okay to miss conceptual classes during the initial identification step. The domain model can be updated when they are discovered later (e.g. during design work).

STRATEGIES FOR IDENTIFYING CONCEPTUAL CLASSES The following techniques can be used:  use a conceptual class category listconceptual class category  identify noun phrases Identify nouns and noun phrases in textual descriptions of a domain, and consider them as candidate classes or attributes.textual descriptions of a domain Weakness: natural language is imprecise  E.g. different noun phrases may represent the same conceptual class or attribute.

 use analysis patterns Analysis patterns are existing partial domain models created by experts

CASE STUDY: PROCESS SALE Based on a simplified scenario of Process Sale, the following candidate conceptual classes are identified using the first two techniques above: RegisterProductSpecification ItemSalesLineItem StoreCashier SaleCustomer PaymentManager ProductCatalog

REPORT OBJECTS Should "receipt" be included in the domain model?  One reason to exclude it: A receipt is a report of a sale. In general, it is not useful to include conceptual classes that reports information that can be derived from other sources.  One reason to include it: A receipt has a special role in the domain. A customer needs a receipt in order to return bought items.

BUILDING A DOMAIN MODEL Apply the following steps: 1.Identify candidate conceptual classes related to the current requirements (use case) under consideration. 2.Represent those classes in a domain model. 3.Add associations necessary to record relationships for which there is a need to preserve some memory. 4.Add attributes necessary to fulfill the information requirements.

SOME GUIDELINES Use the vocabulary of the domain when naming conceptual classes and attributes.  For example, in the library domain, the term "Borrower" or "Patron" is used rather than "Customer" You should not include conceptual classes in the problem domain not pertinent to the requirements.  For the case study, "Pen" and "PlasticBag" should not be included.

You should not include things not in the problem domain.  For example, "Flight" does not exist in the library domain.

ATTRIBUTE OR CONCEPTUAL CLASS? A common mistake when building a domain model is to represent something as an atribute when it should have been a conceptual class. OR Represent "store" as an attribute Represent "store" as a conceptual class

Use the following rule of thumb: If we do not think of some conceptual class X as a number or text in the real world, then X is probably a conceptual class and not an attribute.

Another example, OR

Consider our case study. Let's assume that:  An "Item" represents a physical item in a store.  An "Item" has a description, price and itemID, which are not recorded elsewhere.  Everyone working in the store has amnesia.  Every time a real physical item is sold, a corresponding software object "Item" is deleted from the computer memory. “Rice Brand X” RM “Rice Brand X” RM “Rice Brand X” RM “Rice Brand X” RM11.00 U “Rice Brand X” RM11.00 U “Rice Brand X” RM11.00 U SPECIFICATION OR DESCRIPTION CONCEPTUAL CLASSES

Problems:  Information about the price of a "Rice Brand X" product is lost if the shop is sold out of "Rice Brand X" products.  Space inefficiency as the price and itemID of "Rice Brand X" are duplicated for every "Item" instance of the same product. This illustrates the need for conceptual classes that are specifications or descriptions of other things.

Example:

Add a specification or description conceptual class when:  There needs to be a description about an item or service, independent of the current existence of any examples of those items or services.  Deleting instances of things they describe results in a loss of information that needs to be maintained.  It reduces redundant or duplicated information.

Another example: Airport name Flight date time FlightDescription number 1 * 1 * Describes-flights-to 1 * Described-by * 1 Airport name Flight date number time * 1 Flies-to 1 *

CASE STUDY: INITIAL DOMAIN MODEL Based on the candidate conceptual classes identified previously, an initial domain model can be produced as follows:

ASSOCIATIONS An association is a relationship between classes that indicates some meaningful and interesting connection.

THE UML ASSOCIATION NOTATION associations in domain models are inherently bidirectional reading direction arrow - no special meaning, it's just to aid reading multiplicity expressions "Cashier initiates Sale"

CRITERIA FOR USEFUL ASSOCIATIONS We need to be selective when adding associations to a domain model.  There can be n*(n-1) possible associations in a domain model with n different conceptual classes.  Too many associations in a domain model can make it difficult to understand which defeats its purpose as a communication tool.

Associations worth adding to a domain model are usually those for which knowledge of the relationship needs to be preserved for some duration (even for a millisecond). For example, The SalesLineItem objects associated with a Sale object need to be remembered; otherwise, it would not be possible to print a receipt, for instance.

Also, include associations as suggested by the requirements (use cases).

FINDING ASSOCIATIONS Consider including the following associations in a domain model:  Associations for which knowledge of the relationship needs to be preserved for some duration ("need-to-know" associations).  Associations derived from the Common Associations List.Common Associations List Give priority to these categories  A is a physical or logical part of B  A is physically or logically contained in/on B  A is recorded in B

USEFUL GUIDELINES Focus on "need-to-know" associations. It is more important to identify conceptual classes than to identify associations. Too many associations tend to confuse a domain model. Avoid showing redundant or derivable associations.

Example: DERIVABLE

MULTIPLICITY Multiplicity defines how many instances of a class A can be associated with one instance of a class B. association multiplicity

zero or more; "many" one or more one to 40 exactly 5 T T T T * 1.. * T 3, 5, 8 exactly 3, 5, or 8

Note that the multiplicity value is dependent on our interest as a modeler and software developer. Consider the following possibilities: husband Person Married-to wife 1 Person 1 Married-to wife 1 1 husband Person 1 1..* Married-to wife 1 husband

NAMING ASSOCIATIONS The name of an association should be a verb or a verb phrase. Ensure that it creates a sequence that is readable and meaningful in the model context. By convention, the default direction is left to right or top to bottom. "Airline Employs Person" "Plane Assigned-to Flight"

MULTIPLE ASSOCIATIONS BETWEEN TWO CLASSES It is not uncommon to have multiple associations between two conceptual classes. Consider the following: Both associations need to be shown separately as they indicate distinctly different relationships.

ASSOCIATIONS AND IMPLEMENTATIONS Associations in a domain model represent relationships that are meaningful in the real world. Not all associations in a domain model need to be implemented in software.

DOMAIN MODEL FOR POS SYSTEM (WITH ASSOCIATIONS) Register Item Store Sale Payment Sales LineItem CashierCustomer Product Catalog Product Specification Stocks * Houses 1.. * Used-by * Contains 1.. * Describes * Captured-on Contained-in 1.. * Records-sale-of 0..1 Paid-by Is-for Logs- completed *  Works-on *

ADDING ATTRIBUTES Besides associations, we also need to identify attributes of conceptual classes that are needed to satisfy the information requirements of the current scenarios under development.

ATTRIBUTE An attribute is a logical data value of an object. A domain model should include attributes for which the requirements (such as use cases) suggest or imply a need to remember information. For example, a receipt normally includes the date and time of sale.

NOTATION FOR ATTRIBUTES The type of an attribute is optional. attributes

GUIDELINES FOR IDENTIFYING ATTRIBUTES The attributes in a domain model should preferably be simple attributes or data types. Examples of attribute types:  Boolean, Date, Number, String (Text), Time  Address, Colour, PhoneNumber, SocialSecurityNumber, UniversalProductCode, Postcode

Consider the following: Cashier name currentRegister Cashier name Register number Works-on 1 1 This is not a "simple" attribute

Relate conceptual classes with an association, not with an attribute. destination is a complex concept

ATTRIBUTES AS FOREIGN KEYS Do not use attributes as foreign keys to relate conceptual classes (as typically done in relational database designs). Use associations to relate those classes.

DOMAIN MODEL FOR POS SYSTEM Register Item Store Sale Payment Sales LineItem CashierCustomer Product Catalog Product Specification Stocks * Houses 1.. * Used-by * Contains 1.. * Describes * Captured-on Contained-in 1.. * Records-sale-of 0..1 Paid-by Is-for Logs- completed *  Works-on * quantity dateTime total amountTendered name address number itemID description price number