COC2073 - Module 4 (Software Architecture & Design)
COC2073 - Module 4 (Software Architecture & Design)
COC2073
Module 4: Software Architecture & Design
Muhammad Shahid
Department of Computer Science
National Textile University
[email protected]
Last Lecture Review
I need a
tower, with a
big clock
The king's
requirements
I need a
tower, with a
big clock
Architecture
The king's
requirements Construction
Software is different
▪ No physical natural order of construction (e.g.
start with the foundation of the house)
▪ Software is not tangible
Architecture
Requirements Implementation
Scale up …
Scale out …
Availability Integrity
▪ Right information is ▪ Only authorized users
available at the right time can modify, edit or delete
▪ Important for everyone data.
▪ E.g. bank systems
Critical
22 Divide
Software & Conquer
Engineering Strategy
Fundamentals - COC2073
Problem Partitioning
Horizontal Vertical
Partitioning Partitioning
Function 1 Function 3
Function 2
Decision
Making
Modules
"Working"
Modules
▪ Repository Architecture
▪ Layered Architecture
Client
Software
Client Client
Software Software
Data Store /
Repository
Client Client
Software Software
Client
Software
Produce
Generate
Analyze Build/Test
Design
Enterprise Production
Modelling Software Maintenance
Repository
▪ File Servers
- Client requests selected records from a file and
the server transmits records to client over the
network
▪ Database Servers
- Client sends requests, such as SQL queries, to
the database server, the server processes the
request and returns the results to the client over
the network
▪ Transaction Servers
- Client sends requests that invokes remote
procedures on the server side, server executes
procedures invoked and returns the results to
the client
▪ Groupware Servers
- Groupware servers provide set of applications
that enable communication among clients using
text, images, bulletin boards, video, etc.
▪ Three-Tier architecture
▪ N-Tier architecture
Server
Business
Layer
Data
Management
clients
Server
Data
Management
Data Source
Client Application
Business
Layer
Server
Data
Management
Client
Filters
Pipes
Input Output
Example: A Compiler
Intermediate
Semantic Code
lexer parser Code Optimization
analysis Generation
Generation
Pros Cons
▪ Understandable, easy ▪ Limited to batch
to reason about, in-out processing (not good
▪ Extendable - easy to for interactive apps)
add / remove filters ▪ Duplicated execution,
▪ Easy to simulate and e.g. format checking
analyze properties, ▪ Error handling – hard
e.g. throughput to produce
▪ Concurrent execution understandable error
(both in series and in messages
parallel)
Layer 3
Layer 1 Layer 2
Highest
Abstraction
Layer 1
Layer 2
Define
Interfaces
Layer 3
Pros Cons
▪ Easy reuse of layers ▪ Could give
▪ Support for performance penalties
standardization ▪ Layer bridging looses
▪ Dependencies are modularity
kept local -
modification local to a
layer
▪ Supports incremental
Layer 1 Layer 2 Layer 3
development and
testing
UDDI
Fine/Retrieve Register/Publish
Service-oriented architecture
1) Correctness:
▪ The design of a system is correct if the system
built precisely according to the design satisfies
the requirements of that system
2) Verifiability:
▪ Design should be verified for correctness
▪ Verifiability is concerned with how easily the
correctness of the design can be checked
3) Completeness:
▪ All the different components of the design should
be verified
84 Software Engineering Fundamentals - COC2073
Design Objectives/Properties
4) Traceability:
▪ Entire design element be traceable to the
requirements
5) Efficiency:
▪ Proper use of scarce resources by the system
6) Simplicity:
▪ The most important quality criteria for software
systems
85 Software Engineering Fundamentals - COC2073
Software Design Principles
What do we want?
Low coupling. Why?
▪ Replaceable
▪ Enable changes
▪ Testable - isolate faults
▪ Understandable
Highly Coupled - Many dependencies
class Complex
{
public double real;
public double imaginary;
class Complex
{
private double real;
private double imaginary;
Low Cohesion - The parts e.g. functions Medium Cohesion - Some logically
have less or nothing in common related function. e.g. IO related functions
What do we want?
High cohesion. Why?
▪ More understandable
▪ Easier to maintain
High Cohesion - Does only what it is
designed for?
class Order
{
private int OredrID;
private string CustomerName;
private Date OrderDate;
private float TotalPrice;
private int CustomerID;
private int CustomerPhone;
class Order
{
private int OrderId;
private Date OrderDate;
private float TotalPrice;
public int getOrderID();
class Customer
{
private int CustomerID;
private string CustomerName;
private int CustomerPhone;
Class
Objects
Student
Visibly
+ public - Name:string Return Type
- private - Discipline:string
# protected - CGPA:float
~ package + takeClasses():Integer
+ getCourseRegister():String
+ prepareNotes():String
Vehicle
- Color
- Model
+ Accelerate()
+ ApplyBrakes()
Shape
+ Draw()
Vehicle
+ Door()
+ FillFuel()
Car
+ Reverse()
Vehicle
+ Door()
+ FillFuel()
Car Motorcycle
+ Reverse() + TurnAround()
Vehicle
<<interface>>
IDoor
+ Door()
+ Open() + FillFuel()
Car Motorcycle
+ Reverse() + TurnAround()
<<interface>> SomeVehicle
Door
+ Open() + drive()
+ open()
Interface
Abstract class
▪ Association
▪ Aggregation
▪ Composition
▪ Inheritance
Teacher Course
teaches
+ Salary():int * * + Salary():int
+ Leaves():int + Leaves():int
+ Medical():int + Medical():int
▪ A weak Association
Car Wheel
4
* Picture
Folder
1
Multimedia
Company Department
1 ..
*
Building
Room
2 Person 2 Leg
Arm
1
Body
Student Teacher
- Program - Designation
- StudyYear - Salary
+ Study() + TakeClasses()
+ HeldExam() + takeExam
Student Teacher
- Program - Designation
- StudyYear - Salary
+ Study() + TakeClasses()
+ HeldExam() + takeExam
Student Teacher
- Program - Designation
- StudyYear - Salary
+ Study() + TakeClasses()
+ HeldExam() + takeExam
+ enter()
Daughter
- age
Videogame
suitable
Toy
- price
Boardgame +buy()
+ like()
insertCoin()
Activation-box
Life line
machineReady() of object
Time
pressButton(b1)
pourCoffee()
insertCoin()
Activation-box
Life line
machineReady() of object
Time
pressButton(b1)
pourCoffee()
Y-axis (time)
172 Software Engineering Fundamentals - COC2073
Sequence Diagram - Message Types
▪ Synchronous
▪ Asynchronous
<<create>>
▪ Create
<<destroy>>
▪ Destroy
:object1 :object2
Caller Blocked
areYouOK( ) Return
yes
1:setCourseInfo
2: process
3: addCourse
4: <create>>
:object1 :object2
<<destroy>>
Book Parts
Chapters Sections
LibraryItem Person
- id - name
- title
1..* author
1..* entertainer
1 producer
Book Video CD
1..* actor
0..* 0..* 0..*
* 0..1 6..12
1
1 2 *
4..*
League Team Captain
name 1 1
record