SYST37028 - Sheridan College

Download Report

Transcript SYST37028 - Sheridan College

Agenda
• Today
•
•
•
•
Review last week
Review ICE-08 from last week
Sequence Diagrams
(Continued)
• View & Data Layers
• Cohesion & Coupling
Object Oriented Methods
• Assignment 2 Due Next week [Nov 25th]
• Quiz No 04 – SSDs & Sequence Diagrams
Sheridan
• Schedule
1
• List of all the things the system must be able to do. [Use Cases]
• Defined how each use case works. [Activity diagrams/narratives]
• Identified all the things the system must keep track of. [Classes]
• Real World Example:
• What it does. [Wash clothes]
• How it does it.
•
•
•
•
Adds water & agitates
Rinses
Spin dries
Drains water
• Look at how the Washer System is designed.
• It’s composed of various parts (objects)
Object Oriented Methods
• Design phase requires details on how to program
• To this point we have:
Sheridan
Moving from System Sequence
(SSD) to Full Sequence Diagrams
2
Object Oriented Methods
Sheridan
Review ICE-08
3
Object Oriented Methods
Sheridan
Review ICE-08
4
Object Oriented Methods
Sheridan
Review ICE-08
5
Object Oriented Methods
Sheridan
Review ICE-08
6
7
Object Oriented Methods
Sheridan
Object Oriented Methods
Sheridan
Review ICE-08
8
Quick Review of Last Week
• Create the Design Class Diagram
• Identify the domain class object that has responsibility for the use case.
• (it receives the first message from the controller)
• Identify the other classes that must collaborate with the primary object
class to complete the use case.
Object Oriented Methods
• Select the Use Case
• Identify Object responsibilities
Sheridan
• Constructing Sequence Diagrams
9
Next Step…
Add a <<controller>> object
Add the <<entity>> objects
Add the <<data>> objects
Add the <<boundary>> objects
Sequence the messages
Object Oriented Methods
•
•
•
•
•
Sheridan
• Build the Sequence Diagram
10
Layered Design [1]
• SQL statements are included in the methods of the domain classes
Object Oriented Methods
• View layer
• Business logic layer
Sheridan
• Smaller systems
11
Layered Design [2]
• Sole responsibility is to execute database SQL statements
• Get the results and provide the information to the business logic layer
Object Oriented Methods
• View Layer
• Business Logic Layer
• Data Access Layer
Sheridan
• Larger systems
12
Data Access Layer
• Using the constructor of each domain object
• Approach 2
• Using the data access layer object.
Object Oriented Methods
• Approach 1
Sheridan
• Two ways to instantiate a Customer object in memory from a
data base.
13
Object Oriented Methods
Sheridan
Approach 1
14
Object Oriented Methods
Sheridan
Approach 2
15
Object Oriented Methods
Sheridan
Example – eCommerce System
Use Case: “Cancel Order” [1]
16
Object Oriented Methods
Sheridan
Example – eCommerce System
Use Case: “Cancel Order” [2]
17
Sheridan
Example – eCommerce System
Use Case: “Cancel Order” [3]
18
Object Oriented Methods
Object Oriented Methods
Sheridan
Final Step:- Add View Layer
19
Object Oriented Methods
Sheridan
“Pick-Up Car” Sequence
Diagram
20
21
Object Oriented Methods
Sheridan
• Measures how closely classes are linked
• Cohesion
• Measures the consistency of functions in a class
Object Oriented Methods
• Coupling
Sheridan
Some Fundamental Design Principles
22
Coupling & Cohesion -Fundamental
Design Principles
• Loosely coupled – system is easier to understand and maintain
• Cohesion – qualitative measure of consistency of functions
within a single class
Object Oriented Methods
• Number of navigation arrows in design class diagram or messages
in a sequence diagram
Sheridan
• Coupling – qualitative measure of how closely classes in a
design class diagram are linked
• Separation of responsibility – divide low cohesive class into several
highly cohesive classes
• Highly cohesive – system is easier to understand and maintain and
reuse is more likely
23