domain modelling presented by dr. shazzad hosain
TRANSCRIPT
![Page 1: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/1.jpg)
Domain Modelling
Presented ByDr. Shazzad Hosain
![Page 2: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/2.jpg)
Domain ModelsA domain model is a visual representation of
conceptual classes or real-world objects in a domain of interest.
Identifying a rich set of objects or conceptual classes is at the heart of object-oriented analysis
In domain model no operations are defined. It may showDomain objects or conceptual classesAssociations between conceptual classesAttributes of conceptual classes
![Page 3: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/3.jpg)
Domain Model, a Visual Dictionary of Abstractions
![Page 4: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/4.jpg)
Domain Models are not Models of Software Components
Domain model shows conceptual class, not software class
![Page 5: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/5.jpg)
Domain Models and DecompositionIn structured analysis the dimension of
decomposition is by processes or functions.In OO analysis the division is by conceptual classes
or objects.Example conceptual classes in the Sale Domain
![Page 6: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/6.jpg)
Conceptual Classes1. A conceptual class is an idea, thing or object.2. It may be considered in terms of its symbol, intension and extension
![Page 7: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/7.jpg)
Conceptual Class IdentificationIn incremental model iteratively identify
classes rather than identify all classes at the beginning.
For example, if the iteration is limited to cash-only ProcessSale scenario, then create domain model only for this one
It is better to overspecify a domain model with lots of fine-grained conceptual classes than to underspecify it.
![Page 8: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/8.jpg)
Strategies to Identify Conceptual Classes
Use a conceptual class category listIdentify noun phrases, though need some art
Main Success Scenario (or Basic Flow):1.Customer arrives at the POS checkout with goods and/or services to purchase2.Cashier starts a new sale3.Cashier enters item identifier4.…………
![Page 9: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/9.jpg)
Conceptual Class Category List
Conceptual Class Category
Examples
Physical or tangible objects
Register, Airplane
Places Store, Airport
Transactions Sale, Payment, Reservation
Organizations SalesDepartment, ObjectAirline
Rules and policies RefundPolicy, CancellationPolicy
Things in a container Item, Passenger
…… …….
Table 10.1 Conceptual Class Category List
![Page 10: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/10.jpg)
Candidate Conceptual Classes for the Sales Domain, an Example
Register
Item
Store
Sale
Payment
ProductCatalog
ProductSpecification
Cashier
Customer
Manager
There is no such thing as a “correct” list. It is somewhat arbitrary collection of abstractions.
![Page 11: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/11.jpg)
On Naming and Modeling Things: The MapmakerMake a domain model in the spirit of a
cartographer or mapmakerUser the existing names in the territoryExample, use “Borrower” or “Patron” for
customer in library domainExclude irrelevant features
Pen and PaperBag may be excluded from sales domain
Do not add things that are not there
![Page 12: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/12.jpg)
A Common Mistake in Identifying Conceptual ClassesIf 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.
Example: Should Store be an attribute of Sale, or a separate object
Should destination be an attribute of Flight, or Airport be a separate object
![Page 13: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/13.jpg)
Resolving Similar Conceptual ClassesRegister vs. POST (point-of-sale terminal)
A domain model is not absolutely correct or wrong, but more or less useful; it is a tool of communication
![Page 14: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/14.jpg)
Specification or Description Conceptual Classes
Assume that, Item instance represents a physical item in a store;
An item has a description, price, itemID which are not recorded any-where else.
Every time a real physical item is sold, the corresponding Item instance is deleted from “software land”
Worse Better
![Page 15: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/15.jpg)
Another Specification ExampleLet an airline company suffers a fatal crash of one of its planesConsequently cancels all flights for investigation, delete Flight
instances, no longer a record of what flight routes the airline has
![Page 16: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/16.jpg)
Descriptions of ServicesFlight example is about a service rather than a
good (such as a veggieburger item)Descriptions of services or service plans are
commonly neededAnother example: A mobile company sells
difference packages such as “bronze”, “gold”, “dijuce”, “nababi call rate” etc.
So you need a description class separate from an actual sold package.
![Page 17: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/17.jpg)
Modeling the Unreal World Some software system has little analogy in real
world e.g. software for telecommunications.Still you can create a domain model.
Message
Connection
Route
Port
Protocol Dialog
![Page 18: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/18.jpg)
UML Notations, Models and Methods: Multiple Perspectives
Software / design class
Domain concepts / conceptual class
class
Implementation classe.g. Java Class
![Page 19: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/19.jpg)
Lowering the Representational Gap
![Page 20: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/20.jpg)
Domain Modeling GuidelinesList the objects using category list and noun
phrase identification techniqueDraw them in a domain modelAdd associations necessary to record
relationshipsAdd attributes in necessary
![Page 21: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/21.jpg)
Domain Model: Adding Associations
![Page 22: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/22.jpg)
AssociationsAn association is a relationship between types (or
more specifically instances of those types) that indicated some meaningful and interesting connection.
![Page 23: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/23.jpg)
Criteria for Useful AssociationsKnowledge of a relationship that needs to be
preserved for some duration – may milliseconds or years, depending on context. These are known as “need-to-know” associations.Example: Do we need to remember
SalesLineItem instances for Sale instance.Example: Relationship between Sale and
Manager?If n different objects then n*(n-1) associations. Be
parsimonious. Associations derived from the Common
Association List
![Page 24: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/24.jpg)
UML Association Notation
![Page 25: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/25.jpg)
Finding Associations – Common Association List
Category Examples
A is a physical part of B
Drawer – RegisterWing – Airplane
A is a logical part of B
SalesLineItem – Sale
A is a description for B
FlightDescription – Flight
A is a member of BCashier – StorePilot – Airline
A communicates with B
Customer – Cashier
A is owned by B Plane – Airline
…….. ………….
Table 11.1 Common Association List
![Page 26: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/26.jpg)
RolesEach end of an association is called a role.
Roles may optionally have:Name (will discuss latter)Multiplicity ExpressionNavigability (will discuss latter)
![Page 27: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/27.jpg)
Multiple AssociationsTwo types may have multiple associations
![Page 28: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/28.jpg)
Naming AssociationsTypeName – VerbPhrase – TypeName format where the
verb phrase creates a sequence that is readable and meaningful in the model context
Should start with a capital letterTwo common and equally legal formats for a compound
association name are:Paid-byPaidBy
![Page 29: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/29.jpg)
How Detail Should Association Be?Finding conceptual classes is more important
than finding association. The majority of time spent in domain model creation should be devoted to identifying conceptual classes, not associations.
![Page 30: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/30.jpg)
NextGen POS Domain Model
![Page 31: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/31.jpg)
SuggestionsFocus on need-to-know associationsAvoid redundant or derivable associations
![Page 32: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/32.jpg)
Domain Model: Adding Attributes
![Page 33: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/33.jpg)
AttributesAn attribute is a logical data value of an object
Keep attributes simpleE.g. Boolean, Date, Number, String, TimeOther examples are Address, Color, Universal
Product Code (UPC) etc.Relate conceptual classes with an association,
not with an attribute
![Page 34: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/34.jpg)
Examples
![Page 35: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/35.jpg)
Non-primitive Data Type Classes
Represent as non-primitive class if If composed of separate sections
Phone number, name of personThere are operations usually associated with it, such as
parsing / validationSocial security number
It has other attributesPromotional price could have start date and end date
It is a quantity with a unitPayment amount has a unit of currency
It is an abstraction of one or more types with some of these qualitiesItem identifier may be UPC or EAN (European Article Number)
![Page 36: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/36.jpg)
Where to Illustrate Data Type Classes?
A domain model is a tool of communication; choices about what is shown should be made with that consideration in mind.
![Page 37: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/37.jpg)
Design Creep: No Attributes as Foreign Keys
Relate objects with an association, not with an attribute
![Page 38: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/38.jpg)
Modeling Attribute Quantities and UnitsMost numeric quantities should not be represented as
plain numbers. Consider price or velocity that are associated with units.
![Page 39: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/39.jpg)
Multiplicity From SalesLineItem to Item
Derived attribute indicated with a “/” symbol
![Page 40: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/40.jpg)
Domain Model Conclusion
NextGen POSSystem Model
![Page 41: Domain Modelling Presented By Dr. Shazzad Hosain](https://reader038.vdocuments.us/reader038/viewer/2022110101/56649eb55503460f94bbd924/html5/thumbnails/41.jpg)
ReferencesChapter 10, 11, 12 of “Applying UML and
Patterns – An Introduction to Object-Oriented Analysis and Design and the Unified Process” – by Craig Larman