Dr James Denholm-Price [email protected] XML Lecture 3 Client Server: PHP + XML.
1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr...
-
Upload
oswald-pitts -
Category
Documents
-
view
215 -
download
0
Transcript of 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr...
![Page 1: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/1.jpg)
1
SAD2 - UMLSAD2 - UML44thth Lecture Lecture
Class Diagram in Construction PhaseClass Diagram in Construction Phase
PatternsPatterns
Case StudyCase Study
Lecturer: Dr Dimitrios MakrisLecturer: Dr Dimitrios Makris(([email protected]))
![Page 2: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/2.jpg)
2
Last week
Class Diagram Basic Notation Review Some Advanced Notation
Other Static Views Package Diagram
Workshop: Class Diagram (Conceptual Modelling)
![Page 3: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/3.jpg)
3
Summary of this session Class Diagram in Construction
Phase Patterns Case Study
![Page 4: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/4.jpg)
4
Class Diagrams in Construction phase (Design)
Add implementation details Classes, operations, attributes,
multiplicity, navigability, visibility, etc. How?
Exploit interaction diagrams Use patterns (“GRASP”, “Gang of
Fours’s”)
![Page 5: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/5.jpg)
5
Exploit Interaction Diagram
Collaboration diagram or Sequence diagram?
Work in parallel on both Interaction & Class diagrams
Identify new classes Add operations Add multiplicity and navigability Enhance attributes Determine visibility
![Page 6: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/6.jpg)
6
Patterns Patterns are general solutions to common problems Part of software development method, not part of
UML GRASP (General Responsibility Assignment Software
Patterns) by Graig Larman Expert, Creator, Controller, Low Coupling, High Cohesion,
Polymorphism, Pure Fabrication, Indirection, “Don’t Talk to Stangers”.
Gang of Four’s Patterns by E. Gamma, R. Helm, R. Johnson & J. Vlissides 25 patterns divided in 3 categories according to their
purpose (creational, structural, behavioural)
![Page 7: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/7.jpg)
7
Some GRASP Patterns Expert Creator High Cohesion Low Coupling
Law of Demeter Controller Façade Class
![Page 8: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/8.jpg)
8
GRASP: Expert Problem: “Who, in the
general case is responsible?”
Solution: Assign a responsibility to the information expert -- the class that has the information necessary to fulfill the responsibility.
e.g: Assign calculate_total() behaviour
![Page 9: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/9.jpg)
9
GRASP: Creator Problem: Who creates? Solution: Assign class B the
responsibility to create an instance of class A if one of the following is true: B contains A B aggregates A B has the initializing data for
A B records A B closely uses A
e.g: New PurchaseOrder has been created. Which class is responsible for creating its order lines?
![Page 10: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/10.jpg)
10
GRASP: High Cohesion Problem: How to
keep complexity manageable?
Solution: Assign responsibilities so that cohesion remains high.
e.g: Consider the LiftController class. Is it cohesive?
![Page 11: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/11.jpg)
11
GRASP: Low Coupling Problem: How to
support low dependency and increased reuse?
Solution: Assign responsibilities so that coupling remains low.
e.g: What are the disadvantages of this class diagram? How can they be solved?
![Page 12: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/12.jpg)
12
Law of Demeter:Don’t Talk to Strangers
Use the “Law of Demeter” to reduce coupling. Within a method, messages can only be sent
to the following objects: The this object (or self). A parameter of the method An attribute of self. An element of a collection which is an attribute of
self. An object created within a method
![Page 13: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/13.jpg)
13
GRASP: Controller Problem: Who
handles a system event?
Solution: Introduce a controller class which will be between the actor and the other classes.
E.g: Should “Race” be responsible for displaying its details?
![Page 14: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/14.jpg)
14
Façade Pattern
![Page 15: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/15.jpg)
15
Case study
Let say that we want to develop a email-client program!
How will we use the UML diagrams through an iterative-incremental development process?
![Page 16: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/16.jpg)
16
Recall the Unified Process Stages Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase Analysis Design Coding Testing
Transition Phase
![Page 17: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/17.jpg)
17
Inception Phase Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase Analysis Design Coding Testing
Transition Phase
We have already done that by deciding that we will develop an email client application
![Page 18: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/18.jpg)
18
Use Case Diagram Inception Phase
Elaboration Phase Capture Requirements Model Domain Design Architecture
Construction Phase Analysis Design Coding Testing
Transition Phase
![Page 19: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/19.jpg)
19
Conceptual Model (Class Diagram)
Inception Phase
Elaboration Phase Capture Requirements
Model Domain Design Architecture
Construction Phase Analysis Design Coding Testing
Transition Phase
![Page 20: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/20.jpg)
20
Package Diagram If the scope of the
project is large, then we can split it into smaller manageable pieces, using the package diagram
Inception Phase
Elaboration Phase Capture Requirements Model Domain
Design Architecture Construction Phase
Analysis Design Coding Testing
Transition Phase
![Page 21: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/21.jpg)
21
Use Case Full Text Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase Analysis Design Coding Testing
Transition Phase
Pre-requirements: An Account exists and is selected
Post-requirements: Email sent to the SMTP Server, Message copied to the Outbox Folder
Main Success Scenario: The User selects “Compose Message”. The user edit the fields “To:”, “Cc:”, “Subject”, “Message”. Then, the user selects “Send Message”.
Exceptions: SMTP Server undefined or cannot connect, “To:” undefined
Alternative Scenario: The user selects “Send Message Later”, instead of “Send Message”.
![Page 22: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/22.jpg)
22
Activity Diagram Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase Analysis Design Coding Testing
Transition Phase
![Page 23: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/23.jpg)
23
Sequence Diagram
Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase Analysis
Design Coding Testing
Transition Phase
![Page 24: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/24.jpg)
24
Dynamic viewsin Construction Phase
Other Dynamic Views can be used for the Analysis and the Design Step, e.g: Collaboration Diagram
(Communication in UML2.0) State Diagram Interaction Overview
Diagram
Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase Analysis Design Coding Testing
Transition Phase
![Page 25: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/25.jpg)
25
Implementation Model (Class Diagram)
Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase
Analysis
Design Coding Testing
Transition Phase
![Page 26: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/26.jpg)
26
Coding Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase
Analysis Design
Coding Testing
Transition Phase
From Class Diagrams to Class Definitions
From Dynamic Views to Method Definitions
Packages in Java, C++ and C#
![Page 27: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/27.jpg)
27
From Class Diagram to Class Definitions
public class OrderLine{
private int Quantity;private SKU SKUOrdered;
public OrderLine(int qty, SKU product);public int GetQuantity();public int SetQuantity(int qty);public float Subtotal();
}
![Page 28: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/28.jpg)
28
From Interactive Diagrams to Method Definitions
..public double GetTotal(){
double total=0;OrderLine line;for (int i=0; i<OrderLineList.size(); i++){
line = (OrderLine) OrderLineList.get(i);
total+= line.GetSubtotal();}return total;
}
![Page 29: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/29.jpg)
29
Test & Party! Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase
Analysis Design Coding
Testing Transition Phase
![Page 30: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/30.jpg)
30
Construction Phase iterations
Do the same for each Use Case
Inception Phase Elaboration Phase
Capture Requirements Model Domain Design Architecture
Construction Phase Analysis Design Coding Testing
Transition Phase
![Page 31: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/31.jpg)
31
Promote and Sell the System!
Inception Phase Elaboration Phase
Capture Requirements Model Domain
Construction Phase Analysis Design Coding Testing
Transition Phase
![Page 32: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/32.jpg)
32
Summary The implementation model is easily
derived from the conceptual model and the sequence/collaboration diagrams.
Patterns are standardised solutions to common problems
A case study illustrated the usage of UML in different steps of the Unified Process.
![Page 33: 1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris (d.makris@kingston.ac.uk) d.makris@kingston.ac.uk.](https://reader036.fdocuments.in/reader036/viewer/2022062423/56649e985503460f94b9b291/html5/thumbnails/33.jpg)
33
What is next? This week
Workshop on Class Diagram (Implementation Model)
Next week Feedback on workshop exercises Discuss the assignment