View
213
Download
0
Tags:
Embed Size (px)
Citation preview
Object Oriented Software
Development2009-2010
Modelling business objectsOOSAD Booklet Chapter 4
Lecture: Week 4Brian Farrimond
2
Session Aims Representing attributes and operations in
class association diagrams Drawing class association diagrams
derived from business forms
3
Attributes and operations As we gather requirements we find
out: what information each class of object
needs to record in the form of attributes what the system is supposed to do (we
initially record this in use case diagrams) it is the classes that will be required to carry
out these tasks we need to identify the operations that they
will need to perform to achieve this
4
Attributes and operations in UML The UML class symbol is a box which
is divided into three sections class name class attributes class operations (aka methods)
Demo in StarUML
5
Operations issues in UML All attributes should have:
setter operations to enable other objects to modify attribute values
getter operations that enable other objects to discover those values
Generally we can omit these from UML diagrams since they can be assumed
6
Operations issues in UML Associations do not require
duplicated attributes in UML e.g. do not add a orders attribute to a
Customer class - the association line speaks for itself – avoid duplication
Bad!!
This does the job of modelling what is
going on
7
Operations issues in UML Associations do not require
duplicated attributes in UML e.g. do not add a orders attribute to a
Customer class - the association line speaks for itself – avoid duplication
Good!Duplication
removed
8
Modelling business forms
9
Chapter 4 example
Typical order form
10
Chapter 4 example
First attempt at a class diagram
11
Chapter 4 example
First attempt at a class diagram
Problem with duplication of customer data over a number of his orders
12
Chapter 4 example
Second attempt at a class diagram
Separate class to hold Customer details
13
Chapter 4 example
Now we consider the array.
Neater to extract a class containing the details of each item ordered.
In Java, objects of this class might be held in an ArrayList
14
Chapter 4 example
Now we consider the array.
Neater to extract a class containing the details of each item ordered.
In C++, objects of this class would be held in a vector
15
Chapter 4 example
The new class describes a line on the original order form.
Convention is to name it OrderLine.
16
Chapter 4 example
What would the equivalent class name be for a line on an Invoice?
The new class describes a line on the original order form.
Convention is to name it OrderLine.
17
Chapter 4 example
The new OrderLine class duplicates information about the items being ordered.
18
Chapter 4 example
We can remove this duplication by adding a final class.
19
Chapter 4 example
We can remove this duplication by adding a final class.
20
Exercise 4.7 (page 71)
21
Create a class association diagram for this card
22
Create a class association diagram for this card
23
Create a class association diagram for these forms
Top Grub Order form
Top Grub Invoice form
…. from Database Technology Course.