Domain Model I. Case requirements. Incremental Development. Lecture 4



Similar documents
Domain Modeling. Domain Modeling

How to Make a Domain Model. Tutorial

Principles of Software Construction: Objects, Design, and Concurrency. Domain Modeling and Specifying System Behavior. toad

Iteration 3 Kick Off, Domain Model Refinement. Curt Clifton Rose-Hulman Institute of Technology

Software Development Process

Use Cases. Reference: Craig Larman, Applying UML and Patterns, Ch. 6

LAB 3: Introduction to Domain Modeling and Class Diagram

Chapter 3. Data Analysis and Diagramming

11 November

Object Oriented Design

Database Design Methodology

A terminology model approach for defining and managing statistical metadata

Chapter 2: Entity-Relationship Model. Entity Sets. " Example: specific person, company, event, plant

Developing Entity Relationship Diagrams (ERDs)

Announcements. HW due today, 2 to grade this week Welcome back from Spring Break!

Case studies: Outline. Requirement Engineering. Case Study: Automated Banking System. UML and Case Studies ITNP090 - Object Oriented Software Design

The Entity-Relationship Model

Using Use Cases for requirements capture. Pete McBreen McBreen.Consulting

High-level Design. What is software architecture?

Data Modeling Basics

Object Oriented System Analyze and Design of Revenue Information System using UML

An Approach to Software Architecture Description Using UML

BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT. September 2013 EXAMINERS REPORT

Object-oriented design methodologies

Chapter 2: Entity-Relationship Model. E-R R Diagrams

Relational Database Basics Review

Payment. amount. Payment. amount: Money. getbalance(): Money

Why Data Flow Diagrams?

Chapter 6. Data-Flow Diagrams

Entity-Relationship Model. Purpose of E/R Model. Entity Sets

Announcements. SE 1: Software Requirements Specification and Analysis. Review: Use Case Descriptions

Lecture 9: Requirements Modelling

Collated Food Requirements. Received orders. Resolved orders. 4 Check for discrepancies * Unmatched orders

Algebra I Notes Relations and Functions Unit 03a

CSCI315 Database Design and Implementation

Chap 1. Introduction to Software Architecture

Communication Diagrams

Lesson 8: Introduction to Databases E-R Data Modeling

Object Oriented Software Models

7 Relations and Functions

Options. Acquiring an application. Custom development. Off-the-shelf. Trade-off. Outsourcing development

CDC UNIFIED PROCESS PRACTICES GUIDE

TDDC88 Lab 2 Unified Modeling Language (UML)

Tutorial - Building a Use Case Diagram

Umbrello UML Modeller Handbook

(Refer Slide Time 00:56)

Why & How: Business Data Modelling. It should be a requirement of the job that business analysts document process AND data requirements

BUSINESS RULES AND GAP ANALYSIS

LECTURE 11: PROCESS MODELING

Software Development: An Introduction

Software Development Processes. Software Life-Cycle Models

Object-Oriented Design. CSE 5236: Mobile Application Development Course Coordinator: Dr. Rajiv Ramnath Instructor: Adam C.

User experience storyboards: Building better UIs with RUP, UML, and use cases

Software Requirement Specification

Chapter 3. Data Flow Diagrams

OOP? What is OOP? Why? OOP in a nutshell. Stéphane Ducasse 2.1

6-1. Process Modeling

Chapter 1 Lecture Notes: Economics for MBAs and Masters of Finance

Software Development Processes. Software Life-Cycle Models. Process Models in Other Fields. CIS 422/522 Spring

Software Project Management and UML

Considerations: Mastering Data Modeling for Master Data Domains

Decision Making under Uncertainty

BCS Certificate in Business Analysis Extended Syllabus. Version 2.4 March 2015

Unit 2.1. Data Analysis 1 - V Data Analysis 1. Dr Gordon Russell, Napier University

Using UML Part One Structural Modeling Diagrams

A Comparison of Service-oriented, Resource-oriented, and Object-oriented Architecture Styles

Aerospace Software Engineering

Model Simulation in Rational Software Architect: Business Process Simulation

The Software Process. The Unified Process (Cont.) The Unified Process (Cont.)

Lectures 2 & 3: Introduction to Modeling & UML. Getting started

Scheduling Software User s Guide

Interaction Design. Chapter 5 (June 8th, 2011, 9am-12pm): Sketching Interaction

Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page:

Advanced Topics in Software Construction

Exploratory Testing in an Agile Context

Scenario-based Requirements Engineering and User-Interface Design

ER modelling, Weak Entities, Class Hierarchies, Aggregation

TOGAF 9 Level Exam Study Guide

Foundations of Information Management

Requirement Analysis & Conceptual Database Design. Problem analysis Entity Relationship notation Integrity constraints Generalization

UML for the C programming language.

Entity-Relationship Model

Intermediate PowerPoint

Data Analysis 1. SET08104 Database Systems. Napier University

Lecture 7 Notes: Object-Oriented Programming (OOP) and Inheritance

F.IF.7b: Graph Root, Piecewise, Step, & Absolute Value Functions

Analysis and Design with UML

Objectives After completion of study of this unit you should be able to:

CMPSCI611: Approximating MAX-CUT Lecture 20

4. Incorporate Lessons Learned with SDLC

Agile Software Development

SQL Server Table Design - Best Practices

Topic # 08. Structuring System Process Requirements. CIS Life Cycle and Requirements Structuring Stage

Process Modeling Notations and Workflow Patterns

Counting Money and Making Change Grade Two

2. Analysis, Design and Implementation

RUP Design. Purpose of Analysis & Design. Analysis & Design Workflow. Define Candidate Architecture. Create Initial Architecture Sketch

Data Flow Diagrams. Outline. Some Rules for External Entities 1/25/2010. Mechanics

UML TUTORIALS THE USE CASE MODEL

Bookstore Inventory System Software Design Document. Version 1.0

Transcription:

Domain Model I Lecture 4 Case requirements The requirements for the first iteration of the NextGen POS: Implement a basic, key scenario of the Process use case Implement a Start Up use case as necessary to support the initialization needs of the iteration Nothing fancy or complex is handled No collaboration with external services No complex pricing rules are applied 2 Incremental Development Incremental development for the same use case across iteration 2 3... A use case or feature is often too complex to complete in one short iteration. Use Case Process Use Case Process Use Case Process Therefore, different parts or scenarios must be allocated to different iterations. Feature: Logging Use Case Process Rentals 3

What is a domain model A domain model is a visual representation of conceptual classes or real-situation objects in a domain. Various names conceptual models, domain object models, analysis object models A domain model is illustrated with a set of CLASS DIAGRAMS in which no operations (method signatures) are defined Input Problem Description, Use Cases, Output A set of class diagrams 4 Example concept or domain object s LineItem quantity.. Records-sale-of 0.. Item association Contained-in Stocked-in Store attributes date time 0.. address name Houses Paid-by.. amount Payment Captured-on 4 Register Identifying a rich set of conceptual classes is at the heart of OO analysis 5 Domain models is a visual dictionary Domain model provides a conceptual perspective Domain objects or conceptual classes Associations between conceptual classes Attributes of conceptual classes The information it illustrates could alternatively have been expressed in plain text 6 2

Object and Class concepts Object is a thing with unique identity in a problem domain Joe Smith, the University of Sydney, Australia are all objects All objects have identity and are distinguishable Two apples with the same color, shape, and texture are still individual apples Objects are distinguished by their inherent existence and not by descriptive properties that they may have 7 Classes A class describes a group of objects with the same properties, behaviour and possible relationships. An object is an instance of a class Person, University and Country are classes Domain objects are the focus of modelling Why bother with conceptual class? The power of abstraction The level of abstraction is a matter of judgement and is related with the application. Client s description of a future system may have a combination of classes and objects 8 object & class diagram Person JoeSmith : Person MarySharp : Person : Person Class Objects Person -name : string -dob : Date JoeSmith : Person name : string = Joe Smith dob : Date = Oct 2 983 MarySharp : Person name : string = Mary Sharp dob : Date = March 6 980 Class with Attributes Objects with Values 9 3

Class and conceptual class Domain model is a visualization of things in a real-world domain of interest Domain model should not show software classes avoid datetime sdatabase visualization of a real-world concept in the domain of interest it is a not a picture of a software class software artifact; not part of domain model avoid date time software class; not part of domain model print() 0 Domain model vs. Data model Data model persistent data to be stored somewhere Domain model also include Temporary object Object with no attribute Motivation Help to understand the key concepts in a business or problem domain Lower representational gap with OO Modeling UP Domain Model Stakeholder's view of the noteworthy concepts in the domain. A Payment in the Domain Model is a concept, but a Payment in the Design Model is a software class. They are not the same thing, buttheformerinspired the the naming and definition of the latter. This reduces the representational gap. This is one of the big ideas in object technology. Payment amount Payment amount: Money getbalance(): Money Pays-for date time inspires objects and names in date: Date Pays-for starttime: Time gettotal(): Money... UP Design Model The object-oriented developer has taken inspiration from the real world domain in creating software classes. Therefore, the representational gap between how stakeholders conceive the domain, and its representation in software, has been lowered. 2 4

How to create a Domain Model Steps Find the conceptual classes Draw them as classes in a UML class diagram Add associations a o s and attributes 3 Find conceptual classes Three strategies to find conceptual classes Reuse or modify existing models There are published, well-crafted domain models and data models for common domains: inventory, finance, health.. Books: Analysis patterns by Martin Fowler, Data Model Patterns by David Hay, Data Model Resource Book by Len Silverston Use a category list Identify noun phrases 4 Use a category list Use a conceptual class category list: Physical or tangible objects Register, Airplane Specifications, descriptions of things ProductSpecification, FlightDescription Places Store, Airport Transactions, Payment, Reservation etc. (see Table 9. for a fuller list) 5 5

Noun Phrase Identification Noun Phrase Identification [Abbot 83] Analyze textual description of the domain Identify nouns and noun phrases (indicate candidate classes, objects or attributes) Caveats: Automatic mapping isn t possible Textual descriptions are ambiguous! (different words may refer to the same class, people may refer to things at different abstract levels: class, object, or somewhere in between) 6 Example: a typical description An institution may issue many credit card accounts, each identified by an account number. Each account serves one or more customers who reside at the mailing address. The institution periodically issues a statement for each account. The statement lists a payment due date, finance charge, and minimum payment. The statement itemizes various transactions that have occurred through the billing interval: cash advances, interest charges, purchases, fees and adjustments to the account. The name of the merchant is associated for each purchase. 7 Mapping parts of speech to object model components MailingAddress CreditCardAccount -maximumcredit -currentbalance -accountnumber Institute Customer Statement -statementdate -paymentduedate -minimumpayment -financecharge Transaction -transactiondate -explanation CashAdvance Interest Purchase Fee Adjustment Merchant -name 8 6

Example: find and draw conceptual classes Case study: POS Domain Input fully dressed use case model (excellent textual description of the domain) Iteration-: success (cash-only) scenario of Process use case. Strategy: category list & noun phrase identification There is no such thing as a correct list. It is a somewhat ARBITRARY collection of domain vocabulary that the modelers consider NOTEWORTHY 9 POS Domain model:input 20 Initial POS domain model Register Item Store s LineItem Cashier Customer Ledger Cash Payment Product Catalog Product Description 2 7

Agile modeling style It is normal to miss significant conceptual classes during early domain modeling and to discover them later during DESIGN sketching or PROGRAMMING. We can maintain the model by drawing it with a software engineering tool OFTEN, a long-life OO analysis domain model does not add value 22 Include report objects? Receipt is a noteworthy term in POS domain It has duplicate information contained in sale and payment. Guidelines In general, showing a report of other information in a domain model is not useful However, it might has special role in terms of business rules. We might have a reason to show it in the model. 23 Associations Definition An association is a relationship between objects that indicates some meaningful and interesting connection Objects are usually linked by a ( or a number of ) physical or conceptual connections. Casher Joe Smith works on Register 2. Flight QF435 flies from Sydney to Melbourne association Register Records-current 24 8

When to show association Associations for which knowledge of the relationship needs to be preserved for some duration In the POS domain We need to remember what slineitem instances are associated with a. Cashier may look up ProductionDescription i during the process of sale, but we do not need to remember who looked up what after the sales has been made. We should avoid showing too many associations 25 Associations and implementation There is no direct relationship between associations and implementation. Associations do not indicate a certain implementation construct. Many associations may be implemented in software differently 26 Association Notation -"reading direction arrow" -it has no meaning except to indicate direction of reading the association label -often excluded Register Records-current 4 0.. association name multiplicity 27 9

Naming association Name an association based on a ClassName-VerbPhrase-ClassName format Eg. s paid-by CashPayment Bad alternative: s uses CashPayment Piece is-on Square Bad alternative: Piece has Square 28 Applying UML: multiplicity Multiplicity defines how many instances of a class A can be associated with one instance of class B Store Stocks Item multiplicity of the role 29 Multiplicity values Multiplicity focus on the relationship at a particular moment, rather than over a span of time. Eg. In countries with monogamy laws, a person can be Married-to only one other person at any particular moment, even though over a span of time, that same person may be married to many persons.....40 5 T T T T zero or more; "many" one or more one to 40 exactly 5 3, 5, 8 T exactly 3, 5, or 8 30 0

Object diagram may help to determine the multiplicity Country -has capital CipitalCity Class diagram -name -name China : Country -has capital Beijing : CipitalCity name = China name = beijing object diagram France : Country -has capital Paris : CipitalCity name name 3 Object Diagram to Class Diagram Person -owns stock of Company?? Mary : Person -owns stock of GE : Company Sue : Person -owns stock of Jeff : Person IBM : Company 32 Multiple association between two classes Description :Flight QF435 flies from Sydney to Melbourne -fly from -fly from Sydney : City Flight -fly to City QF435 : Flight -fly to Melbourne : City 33

Reflexive association A conceptual class may have association with itself Eg. A Directory can contain other directories Eg. A node in a liked list is linked to another node -contains -linked to Directory Node 34 Discussion Question Prepare a class diagram from the object diagram below 35 Find association Use the common associations list A is a physical part of B Square - Board A is a logical part of B slineitem - A uses or submanages B Cashier- Register etc. (see table 9.2 on p. 55 for a fuller list) Omit associations that can be defined in terms of other associations. Multiple paths between classes may indicate redundancy However keep the extra association if multiplicity is important. Keep the extra association if they represent an important relationship in the real world. 36 2

The Credit card problem An institution may issue many credit card accounts, each identified by an account number. Each account serves one or more customers who reside at the mailing address. The institution periodically issues a statement for each account. The statement lists a payment due date, finance charge, and minimum payment. The statement itemizes various transactions that have occurred through the billing interval: cash advances, interest charges, purchases, fees and adjustments to the account. The name of the merchant is associated for each purchase. MailingAddress Customer -reside -serve CreditCardAccount -maximumcredit -currentbalance -accountnumber -is issued for Statement -statementdate -paymentduedate -minimumpayment i -financecharge -issue -itemize Institute Transaction -transactiondate -explanation CashAdvance Interest Purchase Fee Adjustment Merchant -name -is made to 37 POS partial domain model Records-sale-of 0.. s LineItem Contained-in.. Ledger Recordsaccountsfor Logscompleted Captured-on 0.. Product Catalog Store Used-by Register Houses.. Contains.. Stocks Product Description Describes Item.. Paid-by Is-for 3 Works-on CashPayment Customer Cashier 38 Attributes An attribute is a logical data value of an object When to show attribute Include attributes that the requirements suggest or imply a need to remember information Eg. needs a datetime attribute Store needs a name and address. 39 3

UML notation Attributes are shown in the second compartment of the class box. Type and other information may optionally be shown Derived attribute The total attribute in the can be calculated from other information It is worth noting down. -datetime : Date - / total : Money Math + pi : Real = 3.4 {readonly} Person firstname middlename : [0..] lastname Private visibility attributes Public visibility readonly attribute with initialization Optional value 40 Suitable attribute types Most attribute types should be what are often thought of as primitive data types Relate conceptual classes with an association, not with an attribute Worse Better Worse Cashier name currentregister name Cashier Flight destination not a "data type" attribute Register Uses number destination is a complex concept Better Flight Flies-to Airport 4 Class or Attributes Class or attribute? If we do not think of some conceptual class X as a number or text in the real world, X is probably a conceptual class, not an attributes 42 4

Data types as attributes We sometimes represent what may initially be considered a number or string as a new data type class in the domain model We can show the data type only in attribute compartment or as a separate class associated with another class. ItemID Address OK Product Description id Store manufacturercode countrycode street street2 cityname... Product Description OK itemid : ItemID Store address : Address 43 Attributes are NOT foreign keys During implementation, there are many ways to relate objects, including foreign key, but the decision should be deferred till DESIGN stage. Worse Cashier name currentregisternumber a "simple" attribute, but being used as a foreign key to relate to another object Better name Cashier Register Works-on number 44 Description Class What s the rationale for representing the description or specification separately from the item In the following domain model, can you tell the difference between (description, price, itemid) and serial number? Item description price serial number itemid Worse ProductDescription description price itemid Describes Item serial number Better 45 5

Description classes When are description classes useful? 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, but was incorrectly associated with the deleted things It reduces redundant or duplicated information Flight date number time Flight date time Airport Flies-to Worse name FlightDescription Better Described-by number Describes-flights-to Airport name 46 Iterative and evolutionary domain model Is the domain model correct? There is no such thing as a single correct domain model! Domain model is incrementally evolve over several iterations. In each iteration, the domain model is limited to the prior and current scenarios under consideration. 47 Discussion Question II Prepare a domain model to describe undirected graphs. An undirected graph consists of a set of vertices and a set of edges. Edges connect pairs of vertices. How would you modify the model to describe directed graphs? 48 6

Generalization We can identify commonality among concepts and define super class (general concept) and sub class (specialized concept) relationships in a domain model Payment superclass - more general concept these are conceptual classes, not software classes Cash Payment Credit Payment Check Payment subclass -more specialized concept 49 Conceptual super class and sub class 00% rule 00% of the conceptual superclass s definition should be applicable to the subclass. The subclass must conform to 00% of the superclass s Attributes Associations Is-a rule All the instances of a subclass must be instances of their superclasses. 50 Conceptual subclass When to define a conceptual subclass? The subclass has additional attributes of interest The subclass has additional associations of interest The subclass concept is operated on, handled, reacted to, or manipulated differently than the superclass or other subclasss, in a way that are of interest The subclass concept represents an animated thing (for example, animal, robot) that behaves differently than the superclass or other subclasses in a ways that are of interest Customer Correct subclasses. But useful? Male Customer Female Customer 5 7

Example subclass partitions Conceptual Subclass Motivation Additional attributes of interest Subclass has additional associations of interests The subclass is operated upon, handled, reacted to, or manipulated differently The subclass concept represents an animated thing that behaves differently than the superclass or other subclasses Examples Book, subclass of LoanableResource, has an ISBN attribute. CreditPayment, subclass of Payment, is associated with a CreditCard class. CreditPayment, subclass of Payment, is handled differently than other kinds of payments in how it is authorized Car, Truck are subclasses of PoweredVehicle, Car behaves differently from Truck 52 When to define a conceptual superclass Create a conceptual superclass in a generalization relationship to subclass when The potential conceptual subclasses represent variations of a similar concept The subclasses will conform to the 00% and Is-a rule All subclasses have the same attribute which can be factored out and expressed in the superclass All subclasses have the same association which can be factored out and related to the superclass 53 Example Transaction -transactiondate -explanation CashAdvance Interest Purchase Fee Adjustment -is made to Merchant -name 54 8

Thanks 55 9