CS计算机代考程序代写 F# COMP2511

COMP2511
Domain Modelling

using UML

Prepared by Dr. Robert Clifton-Everest

Updated by Dr. Ashesh Mahidadia

Domain Models
• Domain Models are used to visually represent important domain concepts and

relationships between them.

• Domain Models help clarify and communicate important domain specific concepts and
are used during the requirements gathering and designing phase.

• Domain modeling is the activity of expressing related domain concepts into a domain
model.

• Domain models are also often referred to as conceptual models or domain object models.

• We will be use Unified Modeling Language (UML) class diagrams to represent domain
models.

• There are many different modelling frameworks, like: UML, Entity-Relationship, Mind
maps, Context maps, Concept diagrams. etc.

COMP2511: Concept Modelling using UML 2

Requirements Analysis vs Domain modelling
• Requirements analysis determines external behaviour

“What are the features of the system-to-be and who requires these features (actors) ”

• Domain modelling determines (internal behavior) –
“how elements of system-to-be interact to produce the external behaviour”

• Requirements analysis and domain modelling are mutually dependent – domain
modelling supports clarification of requirements, whereas requirements help building up
the model.

COMP2511: Concept Modelling using UML 3

What is a domain?

• Domain – A sphere of knowledge particular to the problem being solved

• Domain expert – A person expert in the domain

• For example, in the domain of cake decorating, cake decorators are the domain experts

COMP2511: Concept Modelling using UML 4

Problem
A motivating example:

• Tourists have schedules that involve at least one and possibly several cities
• Hotels have a variety of rooms of different grades: standard and premium
• Tours are booked at either a standard or premium rate, indicating the grade of hotel

room

• In each city of their tour, a tourist is booked into a hotel room of the chosen grade
• Each room booking made by a tourist has an arrival date and a departure date
• Hotels are identified by a name (e.g. Melbourne Hyatt) and rooms by a number
• Tourists may book, cancel or update schedules in their tour

COMP2511: Concept Modelling using UML 5

Ubiquitous language

• Things in our design must represent real things in the domain expert’s mental model.

• For example, if the domain expert calls something an “order” then in our domain model
(and ultimately our implementation) we should have something called an Order.

• Similarly, our domain model should not contain an OrderHelper, OrderManager, etc.

• Technical details do not form part of the domain model as they are not part of the
design.

COMP2511: Concept Modelling using UML 6

Noun/verb analysis

• Finding the ubiquitous language of the domain by finding the nouns and verbs in the
requirements

• The nouns are possible entities in the domain model and the verbs possible behaviours

COMP2511: Concept Modelling using UML 7

Problem
• The nouns and verbs:

• Tourists have schedules that involve at least one and possibly several cities

• Hotels have a variety of rooms of different grades: standard and premium

• Tours are booked at either a standard or premium rate, indicating the grade of
hotel room

• In each city of their tour, a tourist is booked into a hotel room of the chosen grade

• Each room booking made by a tourist has an arrival date and a departure date

• Hotels are identified by a name (e.g. Melbourne Hyatt) and rooms by a number

• Tourists may book, cancel or update schedules in their tour

COMP2511: Concept Modelling using UML 8

UML Class diagrams
• Classes

• Relationships

COMP2511: Concept Modelling using UML 9

UML Class diagrams

• The loosest form of relationship. A class in some way depends on another.

COMP2511: Concept Modelling using UML 10

• A class “uses” another class in some way. When undirected, it is not yet clear in what
direction dependency occurs.

• Refines association by indicating which class has knowledge of the other

UML Class diagrams

• A class contains another class (e.g. a course contains students). Note that the diamond it
at the end with the containing class.

COMP2511: Concept Modelling using UML 11

• Like aggregation, but the contained class is integral to the containing class. The contained
class cannot exist outside of the container (e.g. the leg of a chair)

UML Diagram Types

COMP2511: Concept Modelling using UML 12

Examples

COMP2511: Concept Modelling using UML 13

Representing classes in UML

COMP2511: Concept Modelling using UML 14

Representing classes in UML

COMP2511: Concept Modelling using UML 15

Representing classes in UML

COMP2511: Concept Modelling using UML 16

Representing Association in UML

COMP2511: Concept Modelling using UML 17

Representing Association in UML

COMP2511: Concept Modelling using UML 18

Representing Association in UML

COMP2511: Concept Modelling using UML 19

Attributes vs. Classes
v The most common confusion – should it be an attribute or a class?

o when creating a domain model, often we need to decide whether to represent
something as an attribute or a conceptual class.

v If a concept is not representable by a number or a string,
most likely it is a class.

v For example:

o a lab mark can be represented by a number, so we should represent it as an attribute

o a student cannot be represented by a number or a string, so we should represent it
as a class

COMP2511: Concept Modelling using UML 20

Attributes vs. Classes

COMP2511: Concept Modelling using UML 21

Better

Better

What wrong with the following?

COMP2511: Concept Modelling using UML 22

A Possible solution

COMP2511: Concept Modelling using UML 23

References

• A very detailed description of UML

• https://www.uml-diagrams.org/

• Books that go into detail on Domain Driven Design

• Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans.

• Domain Modeling Made Functional: Tackle Software Complexity with Domain-Driven
Design and F# by Scott Wlaschin.

COMP2511: Concept Modelling using UML 24

https://www.uml-diagrams.org/