Domain Models and Implementations

Examples of Domains

·       Health Care

·       Education

o   Academic Records

o   Scheduling

o   Course Management

o   Online Courses

·       Enterprise

o   Shipping

o   Inventory/Warehouse Management

o   Human Resources

o   Accounting/Payroll

o   E-Store

·       Science

o   Modeling

o   System Control

·       Finance/Banking/Investment

o   Online Banking

o   Portfolio Management

o   Ledgers/Blockchains

·       Entertainment/Gaming

·       Manufacturing

o   Factory Automation

·       Software Engineering

o   CASE Tools

o   Language Processors

o   IDEs

Example: Film Pal

Notes

·       This is a UML package diagram.

·       A package is a collection of related class and interface declarations.

·       Packages are name spaces.

·       The dashed arrows are dependency arrows. They indicate that the source package depends on or uses stuff declared in the target package.

film

Notes

·       Types-as-Objects pattern used to represent movie genre. Use this when type doesn't impact behavior.

·       Actor-Role pattern used to decouple personal info from the roles played by a person.

·       Bi-directional association between Film and Actor needs to be managed by one end or the other.

theater

Notes

·       CreditCard is a class that implements the PaymentMethod interface.

·       Actor-Role Pattern used here, too.

utilities

·       How would Time and Date be implemented? How should we deal with time zones? Why does Time extend Date?

·       How should Location be implemented?

Object Diagrams

A UML object diagram shows objects (instances of classes) and links (instances of associations):

·       Think of an object diagram as an "instance" of a class diagram.

·       Think of an object diagram as a snapshot of memory.

·       Bill Smith uses his Visa card to buy three tickets to the June 4, 2020, 7:30 PM showing of Star Wars at the Coronet Theater. Draw an object diagram of this scenario.

·       How is today's 7:30 PM showing of Star Wars differentiated from tomorrow's 7:30 PM showing?

Domain Patterns (Analysis Patterns)

·       Actor-Role

o   A person wears many hats.

o   Decouple actors (e.g., Person, Organization) from the roles they play (e.g., customer, employee, teacher, student).

·       Types as Objects

o   Represent types as objects (rather than classes) when type doesn't impact behavior (i.e., method implementations).

·       Values

o   Represent values such as quantities as immutable objects with logical equality.

·       Events

o   Events have location, start time, and duration.

o   Events can have participants and a creator/owner.

·       Service

o   Members of a service class (aka utility class) are global—public and static in Java. They can be used anywhere in the program.

o   Service classes are never instantiated. What would be the difference between two instances?

o   A service represents a collection of related functions and variables.

o   Functions are different from methods. They don't have an implicit parameter (this). Therefore they don't represent object behaviors.

·       Composite

o   Hierarchies (Org Charts, trees, taxonomies) and assemblies (devices, programs) are represented using the Composite Pattern:

o   Component is abstract (or an interface)

o   There can be many simple and composite component classes.

o   Instances of the composite pattern are trees. Parent nodes are composites and leaf nodes are simples.

o   Subcomponents is an example of a polymorphic collection.

Concepts, Principles, Technologies

Value versus Reference Objects

Interfaces versus Abstract Classes

Exceptions

What happens if a patron's payment fails? For example, if his credit card is maxed out or expired?

Polymorphism