Академический Документы
Профессиональный Документы
Культура Документы
BITS Pilani
Pilani Campus
BITS Pilani
Pilani Campus
Lecture Session-3
01- 08-13
3
4
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
5
BITS Pilani, Pilani Campus
6
BITS Pilani, Pilani Campus
7
BITS Pilani, Pilani Campus
8
BITS Pilani, Pilani Campus
12
BITS Pilani, Pilani Campus
Other Requirements
While the primary requirements of a computer system tend to be the functional requirements, i.e.,the list of activities that the system must perform, it is also necessary to capture an number of other requirements to build a system, called non-functional requirements. in a Vision Statement, Glossary, Business (Domain) Rules and Supplementary Specification. Produce only the required (or enough) documentation to produce the desired results efficiently and effectively. Documentation costs money and takes time.
14
BITS Pilani, Pilani Campus
15
BITS Pilani, Pilani Campus
Domain Model
Requirements
Design
17
BITS Pilani, Pilani Campus
Objectives
What is domain model
Domain Model
Illustrate meaningful conceptual classes in a realworld problem domain
Identify conceptual classes or domain objects Show associations between them Indicate their attributes when appropriate
Create initial conceptual model Identify the conceptual classes. Draw them as classes in a UML class diagram. Identify attributes Add associations and attributes
20
BITS Pilani, Pilani Campus
Software Artifacts:
Sale amt item SalesDatabase
vs.
Identify Nouns and Noun Phrases in textual descriptions of the domain. Fully dressed Use Cases are good for this type of linguistic analysis. Its not strictly a mechanical process
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 Apply existing Analysis Patterns
Associations derived from the Common associations list Represented as a solid line between objects
the association is inherently bi-directional may contain a cardinality or multiplicity value optionally contains an arrow for easy reading
Associations
An association is a relationship between classes that indicate some meaningful and interesting relationship
All associations needs to preserve for some duration are discovered and discard all other, theoretical associations in our domain model.
Product
*Prod No. Description Unit Price Qty in Stock
Customer
buys
Finding Associations
High priority associations
A is a physical or logical part of B A is physically or logically contained in/on B A is a member of B A is related to a transaction B A owns B
Association Guidelines
Focus on those associations for which knowledge of the relationship needs to be preserved for some duration (need-to-know associations) More important associations to identify concepts than
Too many associations tend to confuse the conceptual model Avoid showing associations redundant or derivable
BITS Pilani, Pilani Campus
Naming Associations
Association names should start with a capital letter (same as concepts, objects) eg PaidBy, Paid-by Noun phrases help identify objects/concepts Verb phrases help identify associations Use hyphens to separate words when a phrase is used to name something
BITS Pilani, Pilani Campus
Roles in Associations
Each of the two ends of an association is called a role. Roles have name multiplicity expression navigability
Multiplicity
Multiplicity defines how many instances of type A can be associated with one instance of type B at a particular moment in time Multiplicity indicates the number of objects of one class that may be related to a single object of an associated class Can be one of the following types
*, 1 to 1, 1 to 0..*, 1 to 1..*, 1 to n, 1 to 1..n
Product
*Prod No. Description Unit Price Qty in Stock
Customer
Teacher
*Employee No. Name Age Sex Salary
buys
teaches
1
Course
Association Role
The "face" that a class plays in the association.
Multiplicity Values
Multiple Associations
Two classes may have multiple associations between them in a UML class diagram; this is not uncommon:
Attributes
Attribute - is a logical data value of an object.
It is a named property of a class describing values held by each object of the class
Attribute Type: A specification of the external behavior and/or the implementation of the attribute Include the following attributes in a domain model those for which the requirements suggest or imply a need to remember information For example, a sale receipt normally includes a date and time attribute
BITS Pilani, Pilani Campus
Types Of Attributes
Pure data values - expressed as attributes; they do not illustrate specific behaviors;
Example - Phone number A Person can have many Phone numbers
Non-primitive attribute types represent attributes as non-primitive types (concepts or objects) if it is composed of separate sections (name of a person) there are operations associated with it such as validation it is a quantity with a unit (payment has a unit of currency)
KEEP: KEEP: Account, ATM, Account, Bank, ATM, Bank Computer, Bank, Cash Cards, Cashier, Bank Computer, Cashier Station, Cash Cards, Central Computer, Cashier, Customer, Consortium, Transaction Cashier Station,
Owns
Bank Computer0..*
Cashier
Concerns
Entered 0..*
0..*
Has
Cashier transaction
0..*
ATM Entered On
0..*
Cash Card 0..*
Complex Attributes
It is desirable to show non-primitive attributes as concepts in a conceptual model
Flight
destination Flies-to
1 1
Flight
Airport
Domain Model
concept or domain object Sales LineItem quantity 1..* association Stocked-in Contained-in 1 Sale attributes date time 1 Paid-by 1 Payment amount Store address name 1 Houses 1..* Register Captured-on 1 1 0..1 Records-sale-of 1 Item
0..1
55
BITS Pilani, Pilani Campus
"A s ale rep res ents the eve nt of a purchas e tran saction. It has a date and time."
sale-1 sale-2
sale-3
concept's extension
sale-4
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.
Category List
Using a Category List
Class Category Use a list Conceptual of categories and see if they applyExamples within the transactions problem domain : this yields candidate conceptual classes. business Sale, Payment Guideline: These are critical (they involve money), so start with transactions. transaction line items SalesLineItem Guideline: Transactions often come with related line items, so consider these next.
Register, Ledger
Item
Continued Conceptual Class Category roles of people or organizations related to the transaction; actors in the use case Guideline: We usually need to know about the parties involved in a transaction. place of transaction; place of service Examples Cashier, Customer, Store MonopolyPlayer Passenger, Airline Store Airport, Plane, Seat
ProductCatalog FlightCatalog
ProductDescription FlightDescription
BITS Pilani, Pilani Campus
Continued Conceptual Class Category containers of things (physical or information) things in a container other collaborating systems Examples Store, Bin Board Airplane Item Square (in a Board) Passenger CreditAuthorizationSyste m AirTrafficControl Receipt, Ledger MaintenanceLog Cash, Check, LineOfCredit TicketCredit DailyPriceChangeList RepairSchedule
schedules, manuals, documents that are regularly referred to in order to perform work
Example from the Process Sale fully dressed use case note: restrict to current requirements (e.g. cash payment only)
Sales LineItem
Cashier
Customer
Ledger
Cash Payment
Product Catalog
Product Description
Description Classes
Think about description classes when creating an initial list of conceptual classes (or during refactoring): A description class contains information that describes something else;
Item description price serial number itemID Worse
Description Class
Add a description class (for example, Product Description) 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 (for example, Item) results in a loss of information that needs to be maintained, but was incorrectly associated with the deleted thing. It reduces redundant or duplicated information.
BITS Pilani, Pilani Campus
Associations
An association is a relationship between classes that indicate some meaningful and interesting relationship there is a need to remember what SalesLineItem instances are associated with a Sale.
association
Register
Records-current 1 1
Sale
Associations
Naming
Class Name -Verb Phrase- Class Name Sale Paid-by Cash Payment Sale Uses Cash Payment (bad example) Player Is-on Square Player Has Square (bad example) Readable and meaningful Avoid Has or Uses
BITS Pilani, Pilani Campus
Multiplicity
The
multiplicity value communicates how many instances can be validly associated with another, at a particular moment, rather than over a span of time.
Finding Associations
By reading the current, relevant, requirements and asking ourselves what information is needed to fulfil these requirements: what need to know associations are necessary given our current list of candidate concepts Using a list of association categories.
Association Category A is a transaction related to another transaction B A is a product or service for a transaction (or line item) B A is a line item of a transaction B
Finding Associations
Continued Association Category Examples
Customer-Payment
Drawer-Register Square-Board Register-Store
Finding Associations
Association Category A is a member of B A is an organizational subunit of B
Continued
A is next to B
Records-sale-of Product Description Contains 1 1 0..1 Sales LineItem 1 Recordsaccountsfor 1 Used-by Describes 1..*
Ledger
Product Catalog
*
Store Stocks 1 1
*
Item
1..*
Houses
1..* Register
*
Captured-on 0..1 1
Paid-by 1 CashPayment
Is-for 1 Customer
Uses
Register number
OK
Modeling Quantities
Payment amount : Number
not useful
Payment
Has-amount
Is-in
Unit 1 ...
*
Payment amount : Quantity
quantities are pure data values, so are suitable to show in attribute section
better
*
Store Stocks name address 1 1
*
Item
1..*
Houses
1..* Register id 1
*
Captured-on 1 0..1
Is-for 1 Customer
Works-on 1 Cashier id
Summary
A domain model -its concepts , terminology, and the relationships Identifying classes, attributes, associations