Chapter 3 Software Design 2024
Chapter 3 Software Design 2024
Chapter 3 Software Design 2024
Learning Outcome
• Software Architecture
• Object Oriented Design
• Real-time system design
• CASE tools
Architectural Design
•Establishing the overall structure of a software system
•An early stage of the system design process
• However, most large systems are heterogeneous and do not follow a single architectural style
Architecture Attributes
•Performance
•Set of stand-alone servers which provide specific services such as printing, data management, etc.
The area computer system validates the collected data and integrates it with the data from different sources. The integrated data is archived
and, using data from this archive and a digitised map database a set of local weather maps is created. Maps may be printed for distribution
on a special-purpose map printer or may be displayed in a number of different formats.
Subsystem Derived from Layered View
Object Identification
•The most difficult part of object oriented design
•No 'magic formula' for object identification
•Relies on skill, experience, and domain knowledge
•Iterative--you are unlikely to get it right first time
•How is this like anything else you do well?
•Approaches
grammatical based on a description of the system: nouns are objects, adjectives are attributes, verbs are
operations
identify tangible things in the application domain
behavioral, identifying objects based on what participates in what behavior
scenario analysis
Weather Station Objects?
•Use domain knowledge to identify more objects and operations
weather stations should have a unique identifier
weather stations are remotely situated so instrument failures have to be reported automatically, therefore attributes and
operations for self-checking are required
•Active or passive objects?
in this case, objects are passive and collect data on request rather than autonomously
this introduces flexibility at the expense of controller processing time
•What are the objects inside this?
Hardware Control Objects Weather Data Objects
Weather Station Sub-system (Layered)
Object Interface Design
•Specify the detail of the object interfaces so that objects can be developed in parallel
•This means defining
attribute types
the signatures and semantics of object operations
•Use a programming language to achieve precision
•Avoid representation information
Design Evolution
•How would you add pollution monitoring facilities to the weather stations?
•(to sample the air and compute the amounts of different pollutants)
•Changes required:
add an operation report Air Quality to Weather Station. Modify the control software to collect pollution readings.
•A ‘soft’ real-time system is a system whose operation is degraded if results are not produced according to the specified timing
requirements
•A ‘hard’ real-time system is a system whose operation is incorrect if results are not produced according to the timing specification
Stimulus/Response
•Given a stimulus, the system must produce a response within a specified time
•Periodic stimuli. Stimuli which occur at predictable time intervals
For example, a temperature sensor may be polled 10 times per second
•Aperiodic stimuli. Stimuli which occur at unpredictable times
For example, a system power failure may trigger an interrupt which must be processed by the
system
System Design
•Design both the hardware and the software associated with system. Partition functions to either hardware or software
•Design decisions should be made on the basis on non-functional system requirements
•Hardware delivers better performance but potentially longer development and less scope for change
RTS Design process
•Design algorithms to process each class of stimulus and response. These must meet the given
timing requirements
•Design a scheduling system which will ensure that processes are started in time to meet their
deadlines
•Integrate using a real-time executive or operating system
Timing Constraint
•May require extensive simulation and experiment to ensure that
these are met by the system
•Despatcher
RTS Executive Components backup disks) to ensure that the system continues in
operation
Starts process execution.
Process Priority
•The processing of some types of stimuli must sometimes take priority
•Interrupt level priority. Highest priority which is allocated to processes requiring a very fast
response
•Clock level priority. Allocated to periodic processes
•Within these, further levels of priority may be assigned
Servicing
•Concerned with managing the set of concurrent processes
•Periodic processes are executed at pre-specified time intervals
•The executive uses the real-time clock to determine when to execute a process
•Process period -time between executions
•Process deadline -the time by which processing must be complete
•Furtherinterrupts are disabled, the interrupt serviced •The real-time clock ticks periodically and each tick
and control returned to the interrupted process causes an interrupt which schedules the process
manager for periodic processes
•Interrupt service routines MUST be short, simple and
fast •The process manager selects a process which is
ready for execution
Process Switching
•The scheduler chooses the next process to be executed by the processor. This depends on a
scheduling strategy which may take the process priority into account
•The resource manager allocates memory and a processor for the process to be executed
•The despatcher takes the process from ready list, loads it onto a processor and starts execution
Scheduling Strategies
•Non pre-emptive scheduling
Once a process has been scheduled for execution, it runs to completion or until it is blocked for
some reason (e.g. waiting for I/O)
•Pre-emptive scheduling
The execution of an executing processes may be stopped if a higher priority process requires
service
•Scheduling algorithms
Round-robin
Rate monotonic
Shortest deadline first
User Interface Design
•Designing effective interfaces for software systems
•System users often judge a system by its interface rather than its functionality
•A poorly designed interface can cause a user to make catastrophic errors
•Poor user interface design is the reason why so many software systems are never used
Graphical User Interface (GUI)
•Most users of business systems interact with these systems through graphical interfaces
although, in some cases, legacy text-based interfaces are still used
Advantages
•They are easy to learn and use.
Users without experience can learn to use the system quickly.
•The user may switch quickly from one task to another and can interact
with several different applications.
Information remains visible in its own window when attention is
switched.
•Fast, full-screen interaction is possible with immediate access to
anywhere on the screen
GUI Example
Direct Manipulation Menu Selection Form Fill-in
•Failures that have serious consequences are clearly more damaging than those where repair and recovery
is straightforward
How to Make Reliability Specification?
1. For each sub-system, analyse the consequences of possible system failures.
2. From the system failure analysis, partition failures into appropriate classes.
3. For each failure class identified, set out the reliability using an appropriate metric. Different
metrics may be used for different reliability requirements
4. Identify functional reliability requirements to reduce the chances of critical failures
Bank ATM System
•Each machine in a network is used 300 times a day
•Component Reuse
- Components of an application from sub-systems to single objects may
be reused
•EffectiveUse of Specialists
- Reuse components instead of people. The specialist can create reusable components
•Standards Compliance
- Standards such as UI standard (e.g. , drop-down menu) can be implemented as reusable components to improve
dependability as users are less likely to make mistake
•Accelerated Development
- Avoid original development, speed-up production and hence able to market product early
Problems with Reuse
•Increased Costs
- in understanding whether the application/component/function is suitable for reuse, in testing it
to ensure its dependability and in maintaining the reused item.
•Lack of CASE tool support
•Not-invented-here syndrome
- Some software engineers may think that writing original software is seen as more challenging
than reusing other people’s software
•Maintaining a component library can be expensive
•Finding and adapting reusable components
Safety Specification
•The safety requirements of a system should be separately
specified
•These requirements should be based on an analysis of the
possible hazards and risks
•Safetyrequirements usually apply to the system as a whole
rather than to individual sub-systems. In systems
engineering terms, the safety of a system is an emergent
property
Safety Processes
•Hazard and risk analysis
Assess the hazards and the risks of damage associated with the system
Assess the risk associated to discover their Define how each hazard must be
Identify potential
with each hazard potential root causes taken into account when the
hazards system is designed
Risk Assessment
•Assesses hazard severity, hazard probability and accident probability
•The acceptability of a risk is determined by human, social and •System should be specified so that hazards do not arise or result in
political considerations an accident
•In
most societies, the boundaries between the regions are pushed •Hazard avoidance
upwards with time i.e. society is less willing to accept risk The system should be designed so that the hazard can never arise
during correct system operation
For example, the costs of cleaning up pollution may be less than
the costs of preventing it but this may not be socially acceptable •Hazard detection and removal
The system should be designed so that hazards are detected and
•Riskassessment is subjective neutralised before they result in an accident
Risks are identified as probable, unlikely, etc. This depends on
who is making the assessment •Damage limitation
The system is designed in such a way that the consequences of an
accident are minimised
Specifying Forbidden Behaviour
•The system shall not allow users to modify access permissions on any files that they have not
created (security)
•The system shall not allow reverse thrust mode to be selected when the aircraft is in flight
(safety)
•The system shall not allow the simultaneous activation of more than three alarm signals (safety)
Security Specification
•Has some similarities to safety specification
Not possible to specify security requirements quantitatively
The requirements are often ‘shall not’ rather than ‘shall’ requirements
•Differences
•Identify potential causes of the hazard. Usually there will be a number of alternative causes. Link these on the fault-tree with ‘or’ or ‘and’
symbols
•Consider the following example which considers how data might be lost in some system where a backup process is running
Fault Recovery
•Forward recovery
Apply repairs to a corrupted system state
•Backward recovery
Restore the system state to a known safe state
•Forward recovery is usually application specific -domain knowledge is required to compute
possible state corrections
•Backward error recovery is simpler. Details of a safe state are maintained and this replaces the
corrupted system state