CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve...
Transcript of CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve...
![Page 1: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/1.jpg)
More Domain Model
Refinement CSSE 574: Session 6, Part 3
Steve Chenoweth
Phone: Office (812) 877-8974
Cell (937) 657-3885 Email:
![Page 2: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/2.jpg)
Modeling Changing States
Suppose a concept X has multiple states
Draft vs. Sent Email
Purchase Request vs. Purchase Order
Do not model the states as subclasses of X!
Instead:
Define a State hierarchy and associate X with State
or,
Ignore showing the states in the domain model
![Page 3: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/3.jpg)
State Example
![Page 4: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/4.jpg)
Association Classes: Consider…
In NextGen POS:
Authorization Services assign a merchant ID to
each store
Payment Authorization Request from store to
service must use the merchant ID
A store has a different merchant ID for each
service
Where should the merchant ID
appear in the domain model?
![Page 5: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/5.jpg)
Guideline
If a class C can simultaneously have many
values for the same attribute A, put A in
another class associated with C
![Page 6: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/6.jpg)
Guideline
Association class might be useful in a
domain model if:
The association has a related attribute
Instances of the association class can only last
as long as the association does
There is a many-to-many association between
two concepts and information is needed to
distinguish the pairs
![Page 7: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/7.jpg)
Association Class Examples
![Page 8: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/8.jpg)
Recall, Composition
A composition relationship implies:
An instance of the part belongs to only one
composite instance at a time
The part must always belong to a composite
The composite is responsible for creating/deleting
the parts
Not to be confused
with the composite
pattern, which is
similar. (sigh)
![Page 9: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/9.jpg)
Composition in Domain Models
Guideline: If in doubt, leave it out.
But, consider showing composition when:
Lifetime of part is bounded within lifetime of
composite
An obvious whole-part physical assembly exists
Composite properties propagate to the parts
Composite operations propagate to the parts
![Page 10: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/10.jpg)
Composition in NextGen Domain Model
![Page 11: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/11.jpg)
What about time?
I consult the Emporio Armani…
It might be time for some fall rain!
11 Image from http://www.letsbuyit.co.uk/product/40091309/unisex-other-watches/emporio-armani-
meccanico-skeleton-gents-round-case-black-dial-black-leather-strap-watch.
![Page 12: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/12.jpg)
Problem: What happens to old Sales
when a product’s price changes?
Solutions?
![Page 13: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/13.jpg)
Time Intervals
Q: Where in your own project do you have to model changes over time?
![Page 14: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/14.jpg)
How about Rolls?…
![Page 15: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/15.jpg)
Er, Roles…
Pros and cons?
![Page 16: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/16.jpg)
Qualified Associations
Don’t overdo it…
![Page 17: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/17.jpg)
Supports parallel analysis work
NextGen POS example:
Splitting Domain Model into Packages
![Page 18: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/18.jpg)
NextGen POS Core Package
![Page 19: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/19.jpg)
NextGen POS Sales Package with
Assocations from Core Package
Store is “owned” by Core
package, but also shown
here to illustrate associations
![Page 20: CSSE 574: Session 6, Part 3 · More Domain Model Refinement CSSE 574: Session 6, Part 3 Steve Chenoweth Phone: Office (812) 877-8974 Cell (937) 657-3885 Email: chenowet@rose-hulman.edu](https://reader034.fdocuments.us/reader034/viewer/2022050215/5f6147dfc88cec4f894c2f45/html5/thumbnails/20.jpg)
If Domain is big enough to partition into
packages, Group conceptual Classes that:
Are in the same subject area
Are in the same class hierarchy
Participate in the same use cases
Are strongly associated
Q: Does your project’s domain model need updating / detailing?