5 - Domain Modeling v1

5 - Domain Modeling v1 - Domain Modeling Contents Domain...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Domain Modeling Contents Domain model 2.  Conceptual class 3.  Description class 4.  Association 5.  Attribute 6.  Data type class 7.  Conceptual class hierarchy 8.  State class 9.  Association class 10.  Domain package model 1.  2 1. Domain Model   Is a representation of conceptual, business, or real-world classes.   Is also called conceptual model, domain object model, analysis model, and analysis object model.   Shows o  domain objects or conceptual classes o  associations between conceptual classes o  attributes of conceptual classes   Does not show operations. 3 A Domain Model 4 Business Object Model vs. Domain Model BOM serves as an abstraction of how business workers and business entities need to be related and how they need to collaborate in order to perform the business.   BOM is useful in doing enterprise-wide business process engineering.   DM is an incomplete BOM, focusing on things and products that are important to a domain and related to the project undertaken.   5 Sample UP Artifact Influence Sample UP Artifact Relationships Domain Model Business Modeling Sale 1 Sales LineItem 1..* date ... ... ... quantity the domain objects , attributes and associations , that undergo state changes conceptual classes – terms concepts , attributes associations , elaboration of some terms in the domain model Use-Case Model Process Sale Require ments Operation enterItem…) : ( 1. Customer arrives ... 2. ... 3. Cashier enters item identifier . 4.... Post conditions : -... Operation Contracts Cashier … : Item ID … : ... Glossary Use Case Text conceptual classes in the domain inspire the names of some software classes in the design Design Model : Register Design : ProductCatalog : Sale enterItem (itemID quantity , ) spec = getProductSpecitemID) ( addLineItem spec quantity) ( , ... 6 2. Conceptual Class   A conceptual class is a real-world concepts in the domain of interest, not a software class   A central distinction between object-oriented and structured analysis is: division by conceptual classes rather than division by functions. 7 A Good Conceptual Class   Its name reflects its intent   It is a crisp abstraction that models one specific element of the problem domain   It maps on to a clearly identifiable feature of the problem domain   It has a small, well defined set of responsibilities   It is high cohesion   It is low coupling 8 Sources to Find Conceptual Classes   Explore business modeling   Examine use case sequence diagrams   Use CRC analysis   Use RUP stereotypes   Use a category list   Identify noun phrases in use cases 9 CRC Analysis Class Name: BankAccount Responsibilities: Maintain balance things the class does     Collaborators: Bank things the class works with Class, Responsibilities and Collaborators Separate information collection from information analysis o  Part 1: Brainstorm o  All ideas are good ideas in CRC analysis o  Never argue about something – write it down and analyse it later! o  Part 2: Analyse information - consolidate with noun/verb 10 RUP Stereotypes   <<boundary>> class mediates interactions between the system and its environment   <<control>> class encapsulates use-case -specific behavior   <<entity>> class models persistent information about something 11 Conceptual Class Category List   Business transactions o  Sale, Payment o  Reservation   Transaction line items o  SalesLineItem   Product or service related to a transaction or transaction line item o  Item o  Flight, Seat, Meal   Where is the transaction recorded? o  Register, Ledger o  FlightManifest   Roles of people or organizations related to the transaction; actors in the use case o  Cashier, Customer, Store o  Passenger, Airline   Place of transaction; place of service o  Store o  Airport, Plane, Seat   Noteworthy events, often with a time or place we need to remember o  Sale, Payment o  Flight   Physical objects o  Item, Register o  Airplane 12 Conceptual Class Category List (cont.)   Descriptions of things o  ProductDescription o  FlightDescription   Catalogs o  ProductCatalog o  FlightCatalog   Containers of things (physical or information) o  Store, Bin o  Airplane   Things in a container o  Item o  Passenger   Other collaborating systems o  CreditAuthorizationSystem o  AirTrafficControl   Records of finance, work, contracts, legal matters o  Receipt, Ledger o  Maintenance Log   Financial instrument o  Cash, Check, LineOfCredit o  TicketCrdit   Schedules, manuals, documents that are regularly referred to in order to perform work o  DailyPriceChangeList o  RepairSchedule 13 Noun Phrase of a Single-Column Use Case Main Success Scenario (or Basic Flow) 1. Customer arrives at POS checkout with goods and/or services to purchase. 2. Cashier starts a new sale. 3. Cashier enters item identifier. 4. System records sale line item and presents item description, price, and running total. Price calculated from s set of price rules. Cashier repeats steps 2-3 until indicates done. 5. System presents total with taxes calculated. 6. Cashier tells Customer the total, and asks for payment. 7. Customer pays and System handles payment. 8. System logs the complete sale and sends sale and payment information to the external Accounting (for accounting and commissions) and Inventory systems (to update inventory). 9. System presents receipt. 10. Customer leaves with receipt and goods (if any). Extensions (or Alternative Flows) … 7a. Paying by cash: 1. Cashier enters the cash amount tendered. 2. System presents the balance due, and releases the cash drawer. 3. Cashier deposits cash tendered and returns balance in cash to Customer. 4. System records the cash payment. 14 Initial Domain Model 15 3. Description Class   A description class contains information that describes something else   Add a description class when o  There needs to be a description about an item or service, independent of the current existence of any examples of those items or services o  Deleting instances of things they describe results in a loss of information that needs to be maintained o  It reduces redundant or duplicated information 16 Descriptions About Other Things 17 Descriptions in the Airline Domain 18 4. Association Is a relationship between classes   Is the semantic relationship between two or more classifiers   May have an association name, role names, multiplicity, and navigability   19 Association Guidelines Associations for the knowledge of relationship needs to be preserved for some duration (need-to -remember associations).   Associations derived from the Common Associations List.   It is more important to identify conceptual classes than to identify associations.   Avoid showing redundant or derivable associations.   20 Common Associations List   A is a transaction related to another transaction B o  CashPayment–Sale o  Cancellation–Reservation   A is a line item of a transaction B o  SalesLineItem–Sale   A is a product or service for a transaction (or line item) B o  Item–SalesLineItem (or Sale) o  Flight–Reservation   A is a role related to a transaction o  Customer–Payment o  Passenger–Ticket   A is a physical or logical part of B o  Drawer–Register o  Seat:Airplane   A is a physically or logical contained in/on B o  Register–Store o  Passenger–Airplane 21 Common Associations List (cont.)   A is a description of B o  ProductDescription–Item o  FlightDescription–Flight   A is known/logged/recorded/reported/captured in B o  Sale–Register o  Reservation–FlightManifest   A is a member of B o  Cashier–Store o  Pilot–Airline   A is an organizational subunit of B o  Department–Store o  Maintenance–Airline   A uses or manages or owns B o  Cashier–Register o  Pilot–Airpline   A is next to B o  SalesLineItem–SalesLineItem o  City–City 22 A Partial Domain Model with Associations 23 5. Attribute   An attribute is a logical data value of an object   An attribute can be the results suggested by requirements (e.g., use cases)   An attribute represent the information that needed to remember 24 Attribute Types Boolean Character Date Number String (Text) Time Address Color Geometric (Point, Rectangle) Phone Number Social Security Number Universal Product Code (UPC), Stock Keeping Units (SKU) European Article Numbering (EAU) ZIP or Postal Codes Enumerated Types 25 Derived Attributes Recording the Quantity of Items Sold in a Line Item SalesLineItem SalesLineItem SalesLineItem Item Each line item records a separate item sale . For example, 1 tofu package. 1..* Item Each line item can record a group of the same kind of items . For example, 6 tofu packages . 1..* Item 0..1 Records-sale-of 1 0..1 Records-sale-of 0..1 Records-sale-of /quantity derived attribute from the multiplicity value 26 6. Data Type Class The attributes in a domain model should preferably be data types   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 attribute.   If in doubt, make something as a separate conceptual class rather than as an attribute   27 Guidelines for Data Type Class   It is composed of separate sections o  phone number, name of person   There are operations associated with it, such as parsing or validation o  social security number   It has other attributes o  promotional price could have a start (effective) date and end date   It is a quantity with a unit o  payment amount has a unit of currency   It is an abstraction of one or more types with some of these qualities. o  item identifier in the sales domain is a generalization of types such as Universal Product Code (UPC) and European Article Number (EAN) 28 7. Conceptual Class Hierarchy   Generalization and specialization are fundamental concepts in domain modeling that support an economy of expression   Conceptual class hierarchies are often the basis of inspiration for software class hierarchies 29 Guidelines for Defining a Conceptual Subclass   The subclass has additional attributes o  Book, a subclass of Loanable, has an ISBN attribute   The subclass has additional associations o  Video, a subclass of Loanable, has association with Director   The subclass concept is operated on, handled, related to, or manipulated differently than the superclass or other subclasses. o  Software, subclass of Loanable, requires a deposit before it may be loaned   The subclass concept represents an animate thing that behaves differently than the superclass or other subclasses. o  MaleHuman, subclass of Human, behaves differently than FamaleHuman with respect to shopping habits 30 Justifying Payment Subclass 31 Guidelines for Defining a Conceptual Superclass   The potential conceptual subclasses represent variations of a similar concept   Subclasses conform to the 100% and Is-a rules   All subclasses have the same attribute which can be factored out and expressed in the superclass   All subclasses have the same association attribute which can be factored out and related to the superclass 32 Justifying a Conceptual Class Hierarchy 33 8. State Class   Do not model the changing states of a concept X as subclasses of X.   Rather, define a state hierarchy and associate the state with X, or 34 Modeling Changing States 35 9. Association Class   An association class allow us to add attributes, operations, and other features to an association.   An association class adds extra constraints o  An association cannot exist without the classes it links. o  There can be only one object of the association class between two participating objects. 36 Which One is Legal? Person * * Company * Skill Employment period:dateRange Person * Competency level 37 Solution Person * * 1 1 *     Company Employment period:dateRange * To allow a Person to have more than one Employment with the same Company. Employment is a full class. 38 10. Domain Package Model   A package should contain elements that o  are in the same subject area o  are in a class hierarchy together o  participate in the same use case o  are strongly associated   A referenced element o  is owned by a package but referenced in another package o  uses a pathname as its name: name::ElementName 39 A Domain Package Diagram with Referenced Class A referenced class 40 A Domain Package Diagram with Packages 41 Core Package 42 Payments Package 43 Products Package 44 Sales Package Sales Captured on 4 - Customer 1 1 Initiates Records- sales-on 5 1 Tax LineItem description percentage amount Sale 1 Core:: Register 1 1 SalesLineItem 1..* 1 date isComplete time * 1 Cashier 1..* / quantity 3 Logs- completed 1 Core:: Store 45 Authorization Transaction Package 46 References B. Bruegge and A. Dutoit, Object-Oriented Software Engineering, 3rd nd edition, Prentice Hall, 2010.   J. Arlow and I. Neustadt, UML 2 and the Unified Process, 2nd edition, Addison Wesley, 2005.   M. Blaha and J. Rumbaugh, Object-Oriented Modeling and Design with UML, 2nd edition, Prentice Hall, 2005.   C. Larman, Applying UML and Patterns, 3rd edition, Prentice Hall, 2005.   47 ...
View Full Document

Ask a homework question - tutors are online