![Page 1: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/1.jpg)
Object Oriented Software
Development2009-2010
Modelling business objectsOOSAD Booklet Chapter 4
Lecture: Week 4Brian Farrimond
![Page 2: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/2.jpg)
2
Session Aims Representing attributes and operations in
class association diagrams Drawing class association diagrams
derived from business forms
![Page 3: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/3.jpg)
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
![Page 4: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/4.jpg)
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
![Page 5: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/5.jpg)
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
![Page 6: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/6.jpg)
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
![Page 7: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/7.jpg)
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
![Page 8: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/8.jpg)
8
Modelling business forms
![Page 9: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/9.jpg)
9
Chapter 4 example
Typical order form
![Page 10: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/10.jpg)
10
Chapter 4 example
First attempt at a class diagram
![Page 11: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/11.jpg)
11
Chapter 4 example
First attempt at a class diagram
Problem with duplication of customer data over a number of his orders
![Page 12: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/12.jpg)
12
Chapter 4 example
Second attempt at a class diagram
Separate class to hold Customer details
![Page 13: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/13.jpg)
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
![Page 14: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/14.jpg)
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
![Page 15: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/15.jpg)
15
Chapter 4 example
The new class describes a line on the original order form.
Convention is to name it OrderLine.
![Page 16: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/16.jpg)
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.
![Page 17: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/17.jpg)
17
Chapter 4 example
The new OrderLine class duplicates information about the items being ordered.
![Page 18: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/18.jpg)
18
Chapter 4 example
We can remove this duplication by adding a final class.
![Page 19: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/19.jpg)
19
Chapter 4 example
We can remove this duplication by adding a final class.
![Page 20: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/20.jpg)
20
Exercise 4.7 (page 71)
![Page 21: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/21.jpg)
21
Create a class association diagram for this card
![Page 22: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/22.jpg)
22
Create a class association diagram for this card
![Page 23: Object Oriented Software Development 2009-2010 Modelling business objects OOSAD Booklet Chapter 4 Lecture: Week 4 Brian Farrimond](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d7b5503460f94a5f505/html5/thumbnails/23.jpg)
23
Create a class association diagram for these forms
Top Grub Order form
Top Grub Invoice form
…. from Database Technology Course.