software design & deleopmentchate/2110634/01-fundamentals.pdfcomponent •any piece of software...
TRANSCRIPT
Software Design & Development
Software Design Fundamentals
C. Patanothai 01-Design Fundamentals 1
Social Network Architecture
C. Patanothai 01-Design Fundamentals 2
Android System Architecture
C. Patanothai 01-Design Fundamentals 3
Core Banking System
C. Patanothai 01-Design Fundamentals 4
Cloud Switch/VPC Architecture
C. Patanothai 01-Design Fundamentals 5
NASA JPL, Robots and AWS cloud
C. Patanothai 01-Design Fundamentals 6
Software Design Fundamentals
• General design concept
• Context of software design in SDLC
• Software design process
• Enabling techniques
C. Patanothai 01-Design Fundamentals 7
The Process of Design
• Definition: – Design is a problem-solving process whose
objective is to find and describe a way: • To implement the system’s functional
requirements...
• While respecting the constraints imposed by the non-functional requirements... – including the budget
• And while adhering to general principles of good quality
C. Patanothai 01-Design Fundamentals 8
Design as a series of decisions
• A designer is faced with a series of design issues – These are sub-problems of the overall design problem.
– Each issue normally has several alternative solutions: • design options.
– The designer makes a design decision to resolve each issue. • This process involves choosing the best option from among the
alternatives.
C. Patanothai 01-Design Fundamentals 9
Making decisions
• To make each design decision, the software engineer uses:
– Knowledge of
• the requirements
• the design as created so far
• the technology available
• software design principles and ‘best practices’
• what has worked well in the past
C. Patanothai 01-Design Fundamentals 10
Design space
• The space of possible designs that could be achieved by choosing different sets of alternatives is often called the design space
– For example:
C. Patanothai 01-Design Fundamentals 11
Component
• Any piece of software or hardware that has a clear role.
– A component can be isolated, allowing you to replace it with a different component that has equivalent functionality.
– Many components are designed to be reusable.
– Conversely, others perform special-purpose functions.
C. Patanothai 01-Design Fundamentals 12
Module
• A component that is defined at the programming language level
– For example, methods, classes and packages are modules in Java.
C. Patanothai 01-Design Fundamentals 13
System
• A logical entity, having a set of definable responsibilities or objectives, and consisting of hardware, software or both. – A system can have a specification which is then
implemented by a collection of components. – A system continues to exist, even if its components are
changed or replaced. – The goal of requirements analysis is to determine the
responsibilities of a system.
– Subsystem: • A system that is part of a larger system, and which has a definite
interface
C. Patanothai 01-Design Fundamentals 14
UML diagram of system parts
C. Patanothai 01-Design Fundamentals 15
Software Design Process
• Architectural design
– Decomposition
– Component
• Detailed design – Behavior of components
C. Patanothai 01-Design Fundamentals 16
Software Design
C. Patanothai 01-Design Fundamentals 17
Information
model
Functional
model
Behavioral
model
Other
requirements
Design
Code
Test
Data design
Architectural
design
Procedural
design
Program
modules
Integrated
& validated
software
Design
• Data design
• Architectural design
• Procedural design
C. Patanothai 01-Design Fundamentals 18
Design Fundamentals
• Abstraction
• Refinement
• Modularity
• Software Architecture
• Control Hierarchy
• Data Structure
• Software Procedure • Information Hiding
C. Patanothai 01-Design Fundamentals 19
Design Fundamentals
• Abstraction
– Level of detail/language used to describe a problem
– Types of abstraction
C. Patanothai 01-Design Fundamentals 20
…notion of “abstraction” permits one to concentrate on a
problem at some level of generalization without regard to
irrelevant low level details; use of abstraction also permits one
to work with concepts and terms that are familiar in the problem
environment…
[Wasserman]
Abstraction and classes
• Classes are data abstractions that contain procedural abstractions – Abstraction is increased by defining all variables as private.
– The fewer public methods in a class, the better the abstraction
– Superclasses and interfaces increase the level of abstraction
– Attributes and associations are also data abstractions.
– Methods are procedural abstractions • Better abstractions are achieved by giving methods fewer
parameters
C. Patanothai 01-Design Fundamentals 21
Design Fundamentals
• Refinement
– Top/down strategy
– Modularity
C. Patanothai 01-Design Fundamentals 22
In each step, one or several instructions of the given
program are decomposed into more detailed instructions.
This successive decomposition or refinement of
specification terminates when all instructions are
expressed in terms of any underlying computer or
programming language. [Wirth]
Top-down and bottom-up design
• Top-down design
– First design the very high level structure of the system.
– Then gradually work down to detailed decisions about low-level constructs.
– Finally arrive at detailed decisions such as:
• the format of particular data items;
• the individual algorithms that will be used.
C. Patanothai 01-Design Fundamentals 23
Top-down and bottom-up design
• Bottom-up design – Make decisions about reusable low-level utilities. – Then decide how these will be put together to create high-
level constructs.
• A mix of top-down and bottom-up approaches are
normally used: – Top-down design is almost always needed to give the
system a good structure. – Bottom-up design is normally useful so that reusable
components can be created.
C. Patanothai 01-Design Fundamentals 24
Design Fundamentals
• Software Architecture – The hierarchical structure of procedural
components & the structure of data
– Transition between analysis and design
• Control Hierarchy/Program Structure – Organization of modules that implies a hierarchy
of control
– Metrics - depth, width, fan-out, fan-in
– Visibility & connectivity
C. Patanothai 01-Design Fundamentals 25
Control Hierarchy
Module D Module E
Module F
Module I
Module G
Module J
Module H
Module A
Module K
Module B
Module L
Module N
Module R
Module O Module P Module Q
Module M
Module C
Manager
C. Patanothai 01-Design Fundamentals 26
Design Fundamentals
• Data Structure – Logical representation of the relationship among
individual data elements
– Scalar, sequential vector, array, linked list, hierarchical data structure
• Software Procedure – Processing details of each module
– Precise specification includes sequence of events, decision points, repetitive operations, data organization
C. Patanothai 01-Design Fundamentals 27
Design Fundamentals
• Information Hiding
– Modules should be “characterized by design decisions that each hides from all others”
– Modules are designed so that information within a module is inaccessible to other modules with no need for the information
– Defines and enforces access constraints
C. Patanothai 01-Design Fundamentals 28
Modular Design
• Benefits
– Reduces complexity
– Facilitates changes
– Easier implementation
• Activation mechanisms
• Pattern of control
C. Patanothai 01-Design Fundamentals 29
Functional Independence
• Benefits
– Easier to develop
– Easier to maintain & test
• Measures of Independence
– Cohesion
– Coupling
C. Patanothai 01-Design Fundamentals 30
“Design software so that each module addresses a specific
sub-function of requirements and has a simple interface when
viewed from other parts of the program structure”
Cohesion
• “A cohesive module should do just one thing.”
• Levels of Cohesion – Coincidental
– Logical
– Temporal
– Procedural
– Communicational
– Sequential
– Functional
C. Patanothai 01-Design Fundamentals 31
Coupling
• Measure of interconnection among modules
• Levels of Coupling – No direct coupling
– Data coupling
– Stamp coupling
– Control coupling
– External coupling
– Common coupling
– Content coupling
C. Patanothai 01-Design Fundamentals 32
Design for Portability
• Have the software run on as many platforms as possible
– Avoid the use of facilities that are specific to one particular environment
– E.g. a library only available in Microsoft Windows
C. Patanothai 01-Design Fundamentals 33
Design for Testability
• Take steps to make testing easier
– Design a program to automatically test the software
• Ensure that all the functionality of the code can by driven by an external program, bypassing a graphical user interface
– In Java, you can create a main() method in each class in order to exercise the other methods
C. Patanothai 01-Design Fundamentals 34
Open Close Principle (OPC)
• Open for extension and closed for modification
C. Patanothai 01-Design Fundamentals 35
Interface Segregation Principle
C. Patanothai 01-Design Fundamentals 36
Package Dependency
C. Patanothai 01-Design Fundamentals 37
Acyclic Dependencies Principle
C. Patanothai 01-Design Fundamentals 38