Summary Complete
Summary Complete
Summary - complete
Business Goals
▸ Software helps to solve business goals:
- Reduce costs
- Improve quality
- Improve capabilities/functionality
- Improve organisation’s market position
- Improve external confidence
▸ Ultimately: Improve Business Value
- We choose projects that will improve value by the most
- Software vendors will build products that maximise their profits
▸ Different stakeholders have different views and priorities
- Can even lead to conflicting goals between different stakeholders
- Development much cater for all stakeholders
▸ Priority of Goals
- Some goals are nice to have vs. some goals are absolutely critical
- Sometimes, we need to push back goals or make trade offs
▸ Source of Goals
- Some goals are inherent/essential to the a system
- Some goals result from market analysis
- Some goals are arbitrary and can cause problems
▸ Business goals become software requirements
Software Requirements
▸ Functional Requirements
- Services or functions of a system
▪ Qualitative metrics of the system
▪ A system that records compute sales tax
- Interactions between the system and environment, independent of implementation
- DOCUMENT: The user's expectations of functions in the new system
▸ Nonfunctional/Quality Requirements
- Constraints on the functional requirements OR on the development process
▪ Quantitative metrics of the system
▪ Functional Constraints: Responds in < 1 second; Accuracy of 100m
▪ Development Constraints: Must be in COBOL; Do it in 3 months
▸ DOCUMENT your requirements so that can be Validated & Verified objectively
1 / 45
▸ Constraints (Pseudo-Requirements)
- Imposed by the client or environment in which the system will operate
▪ Must be in COBOL
- DOCUMENT: These user/environment-specified constraints under which the new
system is going to be built upon
2 / 45
Software Design
▸ Software design is both an activity and an artefact:
- Activity: creative process that transforms a problem to a solution
- Artefact: a set of components and their interfaces that satisfy the requirements
▸ The following forces are considered in a software design:
- Requirements Specification (Functional Requirements)
- Designer’s Decisions
- Development Constraints
Requirements
specification
Constraints:
resources, Design Designer’s
experience, process decisions
deadlines etc.
Design
documentation
Source: David Budgen,
Software Design, Addison-
Wesley, 1994
3 / 45
2. Role of Requirements
Stakeholders Tacit
Demands
demands
Elicitation
& reqs
Analysis
Contract
Reqspec
Design
Tracing:
Forwards . . . Program
Backwards . . .
Requirements management: Test
Changing requirements
Op &
maint
Requirements Activities
▸ Feasibility study
- Can the user’s needs actually be satisfied? (Make us 1 million dollars!)
- Is there technology available to actually achieve this? (Take us to Mars tomorrow!)
- Is there enough in the budget to do it?
▸ Requirements elicitation/discovery
- Grab as much of the requirements from multiple stakeholders
- Determines the:
▪ domain
▪ services of the system (functional/non-functional reqs)
▪ constraints
▸ Requirements analysis
- Define and document the requirements
- Collaboration between:
▪ Users with domain knowledge
▪ Developers with implementation knowledge
4 / 45
- Analyse the requirements to see if any of them conflict with each other
- Resolve all the conflicts with the stakeholders, otherwise prioritise them
- Once complete and consistent requirements, these will help produce our models
▪ Scenarios
▪ Use cases
▪ User tasks
▪ Workflows
▸ Requirements specification
- Define each of the requirements in detail
- This will define a contract between the client and developers
Types of Requirements
▸ Data Requirements
- System State and Common States
- I/O Formats
▸ Functional Requirements
- Record, compute, transform, transmit
- Pseudo code
- Activity diagrams
- Screen prototypes
▸ Quality Requirements
- Performance
- Usability
- Maintainability etc.
▸ Other Deliverables
- Documentations
- Installation
- Convert from old to new
- Training documents
▸ Managerial Requirements
- Delivery times
- Legal documents
- Development processes
▸ Helping the reader
- Business goals
- Definitions
- Diagrams
5 / 45
Traditional Requirements
▸ Traditional requirements are poor
- They talk too much about the system
- They don't talk enough about user input
- They usually are not verbose:
▪ What defines an error?
▪ What defines how something is possible?
▸ Fix this by focusing on a user’s perceptive
Users’ Perspective
▸ Users think about a system in terms of its features
▸ Get the user’s stories to provide the context on how the user can potentially use the
system
- Scenarios + Use cases => Complete and Consistent
▸ Scenarios
- Examples of user interaction to complete task/goal
- Verbose—a paragraph describing a specific example user (case study)
- Ideal interaction of the user and the system
▪ This is the ideal/key scenario
- Adds alternative scenarios
▪ These are the alternative scenarios
▸ Use Cases
- Structured scenarios that represent the scenarios from user’s viewpoint
- Sequence of actions, with variants
- The use case is general—generalise the scenario with actors:
▪ Actors perform a role in a use case:
▹ An actor can perform many use cases
▹ One use case may have many actors
▪ Actors aren’t always humans: they can be external systems or a device
6 / 45
Platform
Clients Product
User Control
computers
activities
Domain
I/O Elevators
Product
I/O
7 / 45
8 / 45
The system shall store the following domain entities: The system shall store the following domain entities:
name,
address1,
address2, Guest
Guest address3, name, price
passport
Service Service
Stay Service Stay Service
Type Type
stay#,
paymethod, date, count
Room employee Room
State State
❌
date, #persons,
✅
state (booked|occupied|repair)
▸ Use this to model out the domain—higher level abstraction of the system
▸ The RHS is TOO SPECIFIC for the implementation details (only in detail design phase)
Task Descriptions
▸ Work areas:
- Provides the context of the users
- The work area (domain requirement) is supported by tasks (product requirements)
▸ Tasks descriptions:
- Provide the way in which work areas are satisfied
- The product requirements that satisfy the domain requirements
9 / 45
Supporting tasks
Task: 1.2 Checkin
Purpose: Give guest a room. Mark it . . .
Frequency: . . .
Sub-tasks: Example solution:
1. Find room. System shows free rooms on floor
Problem: Guest wants neighbour maps. System shows bargain prices,
rooms; price bargain. time and day dependent.
2. Record guest as checked in. (Standard data entry)
3. Deliver key. System prints electronic keys. New
Problem: Guest forgets to return the key for each customer.
key; guest wants two keys.
Variants:
1a. Guest has booked in advance. System uses closest match
Problem: Guest identification fuzzy. algorithm.
28
▸ In use cases, the system and actor are considered separately
▸ In user tasks, we don't split these actors—consider them as one
11 / 45
3. Software Quality
▸ Software quality conforms to:
…
- explicit functional and
Availability
performance requirements Quality attribute
Modifiability
- explicit development standards may be further
Software Performance refined into
Quality
- implicit characteristics expected Security
sub-attributes
of all software Testability
▸ Problems: Usability
Quality Models
12 / 45
▪ Product operations
Quality Attributes
▸ Types of quality attributes:
- Availability: system provide’s its functional requirements when expected?
▪ ReliabilityRR
- Modifiability: can make reasonable changes at reasonable costs?
▪ Maintainability: how easily the system can be modified to amend bugs?
▪ Portability: how easily the system can run on differing hardware/OS?
▪ Scalability: how easily the system can capacity more information/users?
- Performance: system responds to user input quickly?
- Security: user handles user authentication for specific system services?
▪ Integrity: data of the system cannot be changed in an unauthorised manner?
- Testability: can the system be exercised to ensure confidence in correctness?
- Usability: how easy is it for users to perform user tasks?
▪ Operability: system is easy to use and learn?
▸ These apply to both the product and process
- product = delivered to user
- process = produces the product
- resources = product and process require resources
▸ An underlying assumption is quality process is likely to lead to quality software
- i.e., quality-driven design
▸ Quality attributes can be internal or external
- External
▪ Derived between relationship between the environment and the system
▪ Reliability, Usability
- Internal
▪ Deprived immediately from the product or process description
▪ “Internal quality leads to external quality”
▪ Efficiency, Operability
▸ Tools that help identity quality attributes:
- QAS (Quality Attribute Scenarios)
▪ Systematic approach to deal with quality aspects
▪ Prone to being inadequate; may need extension
- Hypotheses
▪ Identify 3-5 quality attributes from the domain
13 / 45
Requirements V&V
▸ Validation
- Building the right product?
- Meeting stakeholders expectations?
- Requirements realistic, achievable, prioritised?
- Requirements tradable to business goals?
▸ Verification
- Building the product right?
- Requirements implemented correctly?
- Come up with some objective, measurable testing scenario?
▸ Traceability
- Forward and backward direction
▪ Where did the requirement come from?
▪ Does it originate from a business goal?
- What priority does it have?
- Where in the design/implementation is it being addressed?
- What are the implications on the design/implementation if changed?
▸ SRS has its own quality criteria:
- Correct - each requirement reflects a need
- Traceable - to goals/purpose and design/implementation
▪ Traceability checks above
- Complete - all necessary requirements included
▪ CRUD checks
▪ User scenarios/stories
▹ Each scenario can be covered by Create, Read, Update, Delete + Overview
one or many user tasks
ServiceType
Entity
RoomState
Stay
consistent Task
15 / 45
4. Abstraction
▸ Abstraction stack in software development:
- HIGH
▪ Subsystems
▪ Components
▪ Packages
▪ Interfaces
▪ Objects
▪ ADTs (lists, trees)
▪ Functional abstractions (procedures, methods)
▪ Primitive data types
▪ Simple arithmetic expressions and control sequences
▪ Macros
▪ Symbol names
▪ Machine instructions
- LOW
▸ Abstraction between the problem domain are the relationships between domain entities
▸ Growing a new language
- a large vocabulary of design elements
- based on small set of well understood principles
- experience when and how to use vocabulary
▸ Abstraction and modelling are used at every phase of SDLC
▸ Benefit of a particular abstraction depends on its purpose
▸ Abstraction is key to mastering complexity — helps with functional decomposition
16 / 45
5. Object Design
▸ Real world: An object is a representation of a model
- Abstract model of a real world entity
- An object knows and can do things
- Can talk to other objects
▸ Processing world: You can view an object as a processing element
knows performs
information Processing computations
Object
Interaction Composition
contains performs
information computations
Processing
Element
states differ 13
17 / 45
Decomposition
▸ OO Decomposition is done using OO
Design
▸ Notation for capturing the detail characteristics under a system’s design
- View the system as interaction of multiple objects
▸ Need to find the right object-oriented abstractions:
- ( 1 ) Model the real world
- ( 2 ) Make sure you’re using the right abstraction
▸ Questions to ask when doing OO Design:
- How can we identify objects or classes?
- How do objects interact?
- What roles and responsibilities do objects perform?
▸ We use functional decomposition to decompose a large-scale system into smaller
subcomponents
- However!
▪ Modern systems perform more than one function
▪ Modern systems need to be evolvable and maintainable
▹ This would cause a redesign the whole system
▪ Modern systems need to interoperate with other systems
- Use Object-Oriented Decomposition instead!
▪ Decompose according to the objects a system is meant to manipulate
▪ This is better for complex and evolving systems
Iteration in OO Design
▸ Result of design is not a final product
- Design must be revisited even after implementation
- It is not algorithmic—no one size fits all approach
▸ Design method provides guidelines, and not fixed rules
▸ You need a good sense of style that helps produce clean and elegant designs
▸ Responsibility-driven design
18 / 45
Design Steps
▸ Initial Exploration:
- ( 1 ) find the classes in your system
- ( 2 ) determine the responsibilities of each class
- ( 3 ) determine how objects collaborate with each other to fulfil their responsibilities
19 / 45
21 / 45
Collections
▸ Only need enumeration—Choose the most general
▸ Avoid duplicates—Choose a unique element collection (Set)
▸ Indexable Elements—Choose indexable collection (Array/List/Hash)
▸ Specific Order—Choose collection that allows ordering (Array/List not Set)
Heuristics
▸ System Classes
- ( 1 ) A class should only capture one key abstraction
▪ increase cohesion
- ( 2 ) Keep related data and behaviour in one place
22 / 45
24 / 45
- Commands
▪ Will change the abstract state
▪ Do not return a value
▸ Design by contracts
- Formal Agreements or Contract:
▪ The interface between the object (service provider) and the client (service
consumer)
- Pre-conditions
▪ Before you do the operation, service consumer ensures the condition must be true
▪ If not, then the service provider is not obligated to perform its operation
- Post-conditions
▪ After you do the operation, service provider ensures the condition must be true
▪ Errors must be flagged to the consumer
- Invariants of the service provider must hold after successful execution
- Benefits?
▪ Enforces separation of concerns
▪ Explicit notation of contextualised correctness
▪ Facilities testing and debugging
▪ Enhances documentation—facilities reuse
25 / 45
Design Patterns
▸ Helps us solve recurring problems in programming
- Identify the problem
▪ BUT: Hard to recognise the applicability of the pattern to use with the problem
- While we can't change the language itself, we can introduce standard patterns to use
▸ Proven and good solutions to these problems
- Same solution approach to these problems
- Don't have to reinvent the wheel
- Use best practises which knowingly work
- BUT: Only just generalised 'blueprints'—not actual code abstractions
▪ Think Housing Codes—different houses, but same follow the same Housing Code
- They are:
▪ Widely re-usable in many contexts
▪ Improve communication within teams
▪ Capture knowledge of experienced developers
▪ Arise practical experience
▪ Facilitate training of new developers
▸ Reduces maintenance overhead
▸ Design Patterns aren't about Design
- They describe the iteration, communication and aggregation of entities in programs
- It's all about managing complexity of these entities
- They do not tell you about application-specific abstractions
▸ Design patterns are not algorithms
- Algorithms solve computational problems
- merge sort is an algorithm
- divide and conquer is a pattern
▸ Deigns patterns are not software components or frameworks
- Design patterns document ways to implement components or frameworks
- Frameworks or components may be implementations of design patterns
- Frameworks implement generic software architecture
- They platform independent and are by no means concrete
▪ Instantiation of a pattern means that the template provided becomes specialised
▪ Pattern realisation can really be seen when you hide the specifics of your program
26 / 45
Libraries
▸ Application makes use of libraries
▸ Library code is used in functions or
User Application
procedures Library classes
main()
▸ Think Node package which helps extend
your code for a specific purpose
Frameworks
▸ Application code is called by the
Framework classes
framework
User classes
main()
▸ Inverse relationship of a library
▸ Provide generic functionality and application architecture
▸ Think Node.js framework; your code is called by Node in it’s main
Idioms
▸ Idioms are low-level patterns
▸ How to implement particular aspects of components or relationships
▸ They are language specific
27 / 45
Idiom: Delegation
▸ Delegation allows us to share object behaviour without inheritance
- Inheritance is good to extend object behaviour; more flexible and less structured
- If you're not extending behaviour and just want to combine features, then delegate
▸ You delegate some of your behaviour and pass it to another object
- Reinforces encapsulation
- Ensures responsibilities and roles remain distinct
▸ Example:
- ChessBoard needs to undo its move
- It will delegate that behaviour to its corresponding Move object
public class ChessBoard {
...
public void undoMove() {
if (!(this.moves.isEmpty())) {
Move lastMove = this.moves.lastElement();
lastMove.undo (this);
this.moves.removeElement(lastMove);
}
}
}
- Instead, any class can be a client of that interface by implementing the interface
methods 😊
▸ Example:
- Player interface
▪ Any class that wants to be a chess player client implements the interface Player
- Sortable interface
▪ Any class that wants to be a sortable client implements the interface Sortable
▸ Reduces class coupling BUT adds complexity by having indirection in your code
28 / 45
Patterns
▸ Four aspects to patterns
- ( 1 ) Pattern Name
▪ Patterns have names to improve communication between programmers
▪ The essence of what the pattern does
▪ Programmers abide by these names to know how a program's application of
patterns
▪ My program applies Factory in XYZ… my program has MVC in ABC…
- ( 2 ) Problem Forces
▪ Describes when to use the pattern if the problem can be identified in your program
▪ An iterator patterns helps us with Traversal problems
- ( 3 ) Solution
▪ Describes the elements that constitute the design
▪ Remember, these are general guidelines only
▹ An iterator pattern is but a basic guide
▹ It is not application specific—need to implement for it to work in your own code
- ( 4 ) Consequences
▪ The results and trade offs when using and applying the pattern to your code
▪ Known uses
▪ Competing patterns
Pattern: Template Method
▸ Provide a skeleton of an algorithm in operation
- Subclasses redefine parts of algorithm without changing the algorithm’s structure
Pattern: Strategy
▸ Delegation of a family of algorithms that can be utilised interchangeably by any client
- Used in conjunction with Template Methods
ChessPiece * Behaviour
HorizontalBehav. DiagonalBehav.
VerticalBehav.
return isValid;
}
...
}
30 / 45
Pattern: Composite
▸ Management of a whole-part hierarchy in a consistent way
- Composite (superclass) implements behaviour as well as parts (subclasses)
- Delegation of whole behaviour to its part
Pattern: Observer
▸ Notifications of any clients to inform of state change
- Clients implement a common Observable interface
- The subject notifies each of its observers
(of differing concrete classes) of state changes
when its states change
- Problems? It can be slow if there are a lot of notifiers to notify
▸ Observer pattern can be useful to keep different layers of the application as separate as
possible
update
notify
Business layer
31 / 45
Business object
Change state
Downloaded by PHAN HUY QUANG (huyquangph2004@gmail.com)
lOMoARcPSD|23216638
Pattern: Command
▸ Command decouples an operation that needs to be invoked
▸ Decoupled from the specific way the operation needs to be performed
▸ You can pass the command object around; encapsulate behaviour of the command in the
object itself
32 / 45
33 / 45
Architectures
▸ Subsystems is a system in its own right can be deployed by itself
- Can be deployed and run
▸ Module is a component of a system to provide services to other components
- Not functionally independent; cannot be deployed
- Helpful for development
- Use modules to help form a system/subsystem
▸ Component is a unit of software that encapsulates design and implementation
- Offers an interface to outside components
▸ Architectures
- structure of high-level processing elements
- externally-visible properties of elements
- relationships and constraints between elements
▸ Layered Architectures
- Organise subsystems, modules and components into a set of layers
- Lower layer provides services to layer above
▪ The higher layers utilise the lower layers to perform their functionalities
- Pros:
▪ Each layer can be componentised
▪ Each layer acts independently of the other layers
▪ Development can be incremental—work on the lower layers to the higher ones
- Cons:
▪ You need to design your layers right
▹ Need to get the layer design right from the get go
▹ If not, it means you may need to redesign the whole layer structure
▪ Need a clear division of layers, which can be hard
▹ Difficult to do without the right mindset at the start!
▪ When showing clients your progress, they usually only are about higher layers
▹ Thus, if you show them lower layers, they mightn’t get to see desired product
functionalities
▹ This is because presentation layers usually are a the top layers
▹ Usually no demonstrable outcomes with each layer
34 / 45
35 / 45
Architecture styles
Data-flow
▸ Focuses on functional transformation of input to output
- Data source(s) — where the input(s) comes from
- Data sink(s) — where the output(s) go
▸ Usually no cycles unless a feedback loop is introduced
▸ Not suitable for interactive systems
▸ Examples:
- Batch sequences
- Pipes and filter
▪ Each filter (processing element) processes one type of data transformation
▪ Data flows (pipes) from one filter to the next:
▸ Pros
- Efficiently allows large amount of data to be stored
- Components needn’t worry about how data is created, backed up etc.
- Sharing model can be published as a schema
▪ Means easy coordination between components
▸ Cons
- Components must agree on a schema
- Data evolution is difficult and expensive
▪ Migrating lots of data means translating it to a new schema!
- No scope for management policies
- Difficult to distribute efficiently
▸ Examples:
- GitHub/Git
Client/Server Architecture
▸ Distribute application logic and services to a number of clients and servers
- Advantages:
▪ Distribution of data is straightforward
▪ Effective use of networked systems
37 / 45
Client/Server Architecture
P2P Architecture
▸ Peer to peer is decentralised
- Peers are independent and act as both data suppliers and consumers
▸ Efforts shared amongst interconnected peers
▸ Make a peer makes their resources available to other peers
- Peers are dynamic; they come and go randomly
▸ No centralised coordination
Heterogeneous styles
▸ Systems don’t conform to one architectural model/style
- They incorporate different styles at different levels of abstraction
▸ Locationally heterogeneous:
- Different architecture styles at different areas
- The branches of a main-program-and-subroutine system have a shared data repository
▸ Hierarchically heterogeneous:
- A component is used in one style, but is composed using a different style
- A pipe and filter element is structured in a layered style in itself
▸ Simultaneously heterogeneous:
- A system is described using multiple architectures at once
- A compiler is both a data flow and/or repository system, depending on the viewpoint
38 / 45
Architectural Tactics
▸ Transformations on an architecture or system input
▸ Improves upon an existing architecture’s quality attributes
▸ Examples:
- Availability
▪ Detects faults in the system
▪ Masks the faults or repairs the system from fault
- Modifiability
▪ Detect new changes to the system
▪ Localise each change and ripple changes to system
- Performance
▪ Events arrive
▪ Alter resource demands as requests increase
▪ Scale resources
▪ Response generated within constraints
- Security
▪ Attacks posed
▪ Resist attacks through authentication
▪ Detect that the attack occurred
▪ Recover from an attack
▸ Tactics are not design patterns
- Any pattern implements several tactics
- Implementation of the patterns make choices about the tactics made
39 / 45
Documenting Architectures
▸ Designs help us bridge the gap between requirements and implementation
- Assist software engineers to develop software given a set of requirements
- Help to verify the software built
- Help to produce a blueprint for the implementation
▸ Architectures help express:
- system and its evolution
- communication amongst stakeholders
- planning, management and executing system development
- verify the implementation compliance with architectural descriptions
Purpose of Documentation
▸ Communicate
- Discussing possible solutions to different stakeholders
- Describing the solution in a way they understand (e.g., UML)
- Focusing on big-picture
▸ Specify
- Blueprints for the implementation
- Detailed design specification for developers
- Avoid ambiguity; focus on specifics
▸ Different stakeholders have different interests and needs for documentation:
- Client
- End-user
- Developer
▪ System maintainers
▪ System administrator
- Business manager
- Business analyst
▸ Views
- Focus on aspects of a system using appropriate abstractions
▪ Components: Runtime computational entities
▪ Connectors: Means of communication in which components interact
▪ Allocation: Physical environment of components
▪ Module: Code units and responsibilities (packages)
40 / 45
▹ Problem:
▫ Not standardised
▫ Developers are dumb apparently (well most of them are)
▪ Standardised version is IEEE Conceptual Framework:
▹ A meta-model of software architectures
▹ Addresses specific stakeholder concerns
▹ Separates viewpoints from view
▫ Viewpoint identifies the set of concerns and modelling to address them
▫ Provides a rationale for inconsistencies and unresolved issues
▹ Establish the terms for architectural thinking
▹ Each view corresponds to one viewpoint
41 / 45
▸ Notations
- Can be graphical
▪ Must be used systematically; else leads to ambiguity
▪ Primary use for communication, not specification
▪ Why UML?
▹ Reduce risks by documenting assumptions
▹ Represents industry standard (lel nah it doesn’t)
▹ Is well-defined and open
▪ Examples of UML architecture diagrams on next page
- Can be a DSL
▪ high-level programming languages
▪ basic building blocks are architectural elements (components, connectors)
▪ Primarily outlining specification of architecture (i.e., detailed)
42 / 45
Deployment Diagrams
Runtime components on hardware
43 / 45
44 / 45
Quality Attribute
Scenario
Quality
Requirement
Low importance
High difficulty 53
45 / 45