0% found this document useful (0 votes)
34 views

Slide03 DomainModel

The document discusses domain modeling concepts including: - Objects, classes, associations, aggregation, composition and building domain models. - Discovering objects, classes and associations through requirements elicitation. - Defining associations mathematically and representing them in UML. - Modeling association multiplicity, roles, occurrences and examples. - Distinguishing classes from roles, associations from attributes, and aggregation from composition.

Uploaded by

nchung_65697
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Slide03 DomainModel

The document discusses domain modeling concepts including: - Objects, classes, associations, aggregation, composition and building domain models. - Discovering objects, classes and associations through requirements elicitation. - Defining associations mathematically and representing them in UML. - Modeling association multiplicity, roles, occurrences and examples. - Distinguishing classes from roles, associations from attributes, and aggregation from composition.

Uploaded by

nchung_65697
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Domain Model

Domain Model Overview

Analysis Objects and Classes

Association Multiplicity Aggregation Composition Building a Domain Model Structuring a Domain Model

Requirements Elicitation Activity


Discover the requirements of the system to develop

User e pectations !unctional requirements "on#functional requirements $ qualities


Distribution Security Safety %eliability !ault &olerance Availability


3

Fondue Models: Requirements Elicitation

Domain Model Definition

&he Domain Model captures the concepts in the domain of the problem' and the relationships bet(een them )t establishes the vocabulary of the problem domain

Objects during Requirements P ases

An object is a thing or concept that can be distinctly identified' e*g* a specific person' organi+ation' machine' or message An object can have values associated (ith it' called ,value- attributes* &he values of the attributes can change' but not their number and names Attributes of an object during requirements elicitation or analysis are not allo(ed to be objects An object during requirements elicitation or analysis does not have methods
6

Finding Attributes !uestion


!ind some typical attributes for the follo(ing classes.

A person (ho might receive a letter A person suspected in a criminal case A person having a ban/ account &he person the phone bill is sent to An employee of a company using a security access card
7

Associations

Associations are the 0glue1 that holds together an object#oriented system* 2ithout associations' there is only a set of unconnected classes An association models a relationship bet(een objects &he e istence of an association is conditional. all related classes must e ist Similarly' an occurrence of an association can only e ist if the connected objects all e ist
8

Association: Mat ematical Definition

An association bet(een objects corresponds to the mathematical concept of a relationship % bet(een the classes ,sets- 3i to (hich the objects i belong &he relationship % is a subset of the cartesian product of the sets 34' 35' 6' 3n &he elements of % are called the occurrences of the relationship or the lin/s of the association &he relationship is said to be true for the objects 6' n if and only if , 4' 5' 6' n- belongs to %
4

'

'

&he sets 34' 35' 6' 3n are called the domain of the relationship and n is its arity &he sets 3i are not necessarily different
9

Association in "M#

An association is represented in UM7 as a line connecting t(o ,or more- classes &he name of the association is placed 0on1 or 0beneath1 the line Optionally' a blac/ triangle indicates ho( to read the association relationship

10

Association Occurrences

&he lin/s of an association can be represented by a table of tuples 8ach lin/ is uniquely identified by the objects it connects together* )n the table' there cannot be any identical tuples
&eaches 9rofessor Course Bruce 9ercolation &heory Bruce 9olyhedral Computation :;rg Object#Oriented Soft(are Development :;rg Soft(are !ault &olerance 7uc 9robabilistic Algorithms
11

Association E$am%les

&he printer "eo' of type 9haser <<=="' made by 3ero ' located in room McConnell >55*** Mr* %ich' business man' <5 years old' living in ?ug' S(it+erland' married (ith Mrs* Dufour' *** Mr* %ich o(ns an account (ith the S(iss Union Ban/ A flight corresponds to an aircraft flying a route on some (ee/day
12

Association Multi%licity &'(

Consider a tuple , 5' *** n-* 2e may as/ if there are any objects 4 in 34 such that , 4' 5' 6' nbelongs to %' and ho( many they are* &heir minimal and ma imum numbers are called the multiplicity ,cardinality- of 3 4 in the association %* card,34 in %- @ ,min' ma card,A, 5' 6'
n

- , 4'

' 6'

- %B13

Association Multi%licity &)(

&he multiplicity ,or cardinality- defines the number of objects (hich are allo(ed to be associated (ith each other in an association Multiplicity is sho(n by annotating the ends of the association line' called the association end &he full form is a range ,or even a set of ranges-' e*g* =**4' 4**4' 4**<' =**C' 4**C' an asteris/ C meaning that the upper limit is unlimited Sometimes short forms are used. 4 for 4**4' 5 for 5**5' etc*' and C for =**C
14

Association Multi%licity E$am%le

15

Association Occurrences !uestion

Errors *

16

Association +lass

An association class is an association that is also a class An association class has both association and class properties. it connects t(o or more classes' and it also has attributes and sometimes operations 7i/e for all associations' the identity of an occurrence stems from the connected objects* )n UM7' an association class can participate in an association* 2e do not recommend this practice 17

Association +lass E$am%le

An association class is used (hen an attribute goes (ith the association rather than (ith any of the connected classes 2e (ant to /eep trac/ of the mar/ a student has got for a test &he attribute does not mar/ belong to the student' because a student may ta/e many tests "either does it belong to a test' because many students ta/e the same test

18

Association Roles &'(

An association need not have a name* Usually' role names are more convenient because they avoid the problem of (hich (ay to read the name and they provide names for navigation and code generation

19

Association Roles &)(

%ole names clarify the semantics of an association' especially (hen refle ive As a child' a person has e actly t(o parents* As a parent' a person may have several children*

20

Aggregation &'(

Aggregation is a form of binary association that specifies a (hole#part relationship bet(een an aggregate ,a (hole- and a constituent part &he aggregation relationship is transitive and antisymmetric across all aggregation lin/s' even across those from different aggregation associations )f a is part of b and b is part of c' then a is part of c ,transitivity-* )f a is part of b ,directly or indirectly-' then b cannot be part of a ,antisymmetry21

Aggregation &)(

A part can belong to more than one aggregate' and it may e ist independently of the aggregate Often the aggregate needs the parts' i*e* it is a collection of the parts' but the parts can e ist by themselves (ithout being regarded only as parts 8 ample

A path is an ordered set of segments* A segment can belong to several paths* &he path 0needs1 its segments &he distinction bet(een a plain association and an 22 aggregation is often a matter of taste

Aggregation E$am%les

Aggregation is graphically represented (ith an empty diamond on the association end of the aggregate

23

+om%osition

Composition is a strong form of aggregation* )t has more specific semantics that correspond to physical containment and various notions of o(nership A part may belong ,directly- to only one composite ,at a time-* &he multiplicity of the composite element must therefore be 4 or =**4* &he composite object has responsibility for the disposition of all its parts' i*e* for their creation and destruction
24

+om%osition E$am%le &'(

Composition is graphically represented (ith a filled diamond on the association end of the composite

25

+om%osition E$am%le &)(

Composition may also be sho(n by graphical nesting* A nested elementDs role name is (ritten in front of its class name

26

Associations wit +onstraints

27

Derived Association

28

!ualified Association

29

Discovering t e Domain Model

Brainstorm a list of candidate objects' classes and associations.


9hysical objects. car' pen' *** 9eople' organi+ations. cler/' employee' company' *** 9laces. building' room' *** Concepts. trajectory' ledger' flight' ***

Distinguish objects from classes' and roles from classes Suppress the redundant' irrelevant' vague classes 7oo/ at the use casesE
30

Association versus +lass

9eople hold shares of companiesF there is at most one occurrence of a pair ,company' person9eople purchase shares of companies* 8ach purchase has its o(n date and price in addition to quantity

31

Association versus Attribute

An attribute is an association bet(een a class and a set of values An attribute usually does not have multiple occurrences

8 ample. since some professors teach several courses' course is better made a class' and )s&eacherOf an association bet(een professors and courses

An attribute cannot have attributesF the association class )s&eacherOf bet(een professors and courses could have a term attribute sho(ing (hen the course is given by the professor An association is therefore more fle ible' but donDt overshoot***' e*g* no need to model the date of birth by 32 an association bet(een a person and a date

Part ,ersus Attribute


A pile of plates is made up of plates 8ach plate /eeps its identity' but cannot be used as long as it is in the pile ,the parts cannot be shared&he destruction of the pile leads to the destruction of the plates &he number of plates in a pile varies bet(een +ero and many &he si+e of a pile is an attribute' and not a component of the pile
33

Association - Aggregation - +om%osition

A family is an aggregate object made up of the parents and their children &he relationships father#child' mother#child' brother#sister are plain associations &he contents of a suitcase changes as the user li/esF the relationship bet(een a container and its contents is often an aggregation' rather than a composition association* )s the liquid contents of a bottle really an objectG
34

+lass versus Role

)t is not al(ays easy to distinguish bet(een Class $ Henerali+ation and %ole

35

Domain Model +onstraints

Constraints are used to model requirements' assertions' and invariants that cannot be e pressed by other means' e*g* by multiplicity in associations Constraints are e pressed by te tual annotations' or by using OC7' the Object Constraint 7anguage

36

Domain Model +onstraints E$am%le

37

Reification

&he process of ma/ing out of a concept an object or class is called reification' meaning 0ma/ing it an object1 An important consequence of reification is that some entity suddenly gets an identity %eification can be applied to associations and connected classes A reified association has all the properties of a class* 8specially' it can participate in relationships %eification can be used to structure a class model
38

Reification E$am%le &'(

A flight is a reification of 0an aircraft scheduled on some route on some (ee/day1 A person o(ns a car* A title is a reification of this relationship* A title has an identity' it has attributes on its o(n' it can be transferred &he result of physical composition is naturally an object. e*g* a car is composed of a motor' (heels' etc %eification is often applied to non physical composition. e*g* a department (ith its personnel' buildings' budget' etc

39

Reification E$am%le &)(

40

Reification E$am%le &.(

8 am contains pairs of sets of students and tests belonging to the association &a/es 8 am has the attribute duration An e am is held in a room' (hich sho(s that a composition may participate in an association A test e amines some course' (hich sho(s that a component class can participate in an association
41

/tructuring a Domain Model

&he complete domain model is the union of all the class diagrams' together (ith the related constraints &(o class bo es (ith the same name denote the same class %eification and composition provide means for levelling the diagrams 9ac/ages can be used for defining name spaces' and therefore controlling name scopes
42

/tructuring E$am%le

43

Domain Model Develo%ment /ummary


Develop the Domain Model for the problem domain

Brainstorm a list of candidate classes and relationships )ncrementally produce the Domain Model' loo/ing for.

Henerali+ations' modelling I/ind ofI and Iis aI relationships Aggregations' modelling Ipart ofI and Ihas aI relationships Associations Derived associations Attributes of classes' Attributes of associations Multiplicities of associations Constraints' to be recorded in OC7 ,and$or in te t44

#ibrary !uestion &'(


&he system to build is an automated library boo/ borro(ing system that is to be used in the departmental libraries of a university* &he goal is to relieve the librarians from processing boo/ loans* &he system does not require users to identify themselves to search for boo/s according to certain criteria and to chec/ the availability of a particular boo/* Jo(ever' to chec/#out boo/s' to chec/ their respective boo/ loan status' and to place holds on boo/s that are already on loan' users must first identify themselves to the system*
45

#ibrary !uestion &)(


A single receipt is printed for each user chec/#out sessionF it details for each boo/. the title of the boo/' the unique identifier of the boo/' the date the boo/ (as borro(ed' and the date the boo/ is to be returned by* At the start of each (ee/' the system sends (arning emails to all borro(ers that have overdue boo/s* All information about (hat category of member a user belongs to ,see borro(ing rules belo(-' his$her email address' etc* is available from the central university server* Boo/s have physically attached barcodes' (hich are used for the identification of boo/s that are chec/ed out ,a barcode scanner is to be used-* )f the boo/ does not scan' it should be also possible to enter the barcode manually* Boo/ rene(als ,i*e*' e tending the due date- are not supported in the current version of the system' but this feature is planned for a later release* )t is perceived as an important feature to be supported via the (eb* 46

#ibrary !uestion &.(


&hese are the borro(ing rules.

8ach user has a ma imum number of boo/s that are allo(ed to be on loan at any one time* &he limit is dependent on the category of the member' e*g* department heads can ta/e out as many as 4== boo/s' (here research assistants are limited to 4K boo/s* Often' a certain category of boo/ a different loan period for each category of member' e*g* professors are allo(ed to borro( a standard boo/ for L months' (hereas graduate students are allo(ed only > months* Different categories of boo/s have different loan periods ,e*g*' lecturers may borro( a standard boo/ for > months' but can only loan a periodical for 4 month-* )t might even not be possible' for a certain category of member' to borro( certain boo/s ,e*g* undergraduate students cannot borro( reference boo/s-* Boo/s that are on reserve are not available for loan*
47

You might also like