Introduction to Software Engineering
Introduction to Software Engineering
Engineering
Software failures are a consequence of two factors:
1. Increasing demands
- Systems must be built and delivered more quickly
- New capabilities are required
- Existing methods cannot cope
- new techniques must be developed to meet new demands
2. Low expectations
A professionally developed software system is more than a single program. The system
usually consists of several separate programs and configuration files that are used to set up
these programs.
It may include:
- system documentation
- user documentation
Software engineering
Characteristics:
- maintainability
- dependability & security
- efficiency
- acceptability
Software process
Activities common to software processes:
1. Software specifications
2. Software development
3. Software validation
4. Software evolution
Different types of systems need different development processes.
Example:
- real-time software in an aircraft must be completely specified before development begins
- in e-commerce systems, the specification and the program are usually developed together
TYPES of applications:
Standalone applications: application systems that run on a local computer
Interactive transaction-based applications: applications that execute on a remote
computer and that are accessed by users
Embedded control systems: software control systems that control and manage hardware
devices
Batch processing systems: systems that are designed to process data in large batches
(phone billing systems)
Entertainment systems: primarily for personal use and user entertainment
Systems for modelling and simulation: developed by scientists and engineers to model
physical processes or situations
Data collection systems: systems that collect data from their environment using a set of
sensors and send that data to other systems for processing
Parts of the system which are difficult to specify in advance, such as the user interface,
should always be developed using an incremental model.
Sub-systems within a larger system may be developed using different approaches. Parts of
the system that are well understood can be specified and developed using a waterfall model.
WATERFALL model
- is an example of a plan-driven process
Because of the costs of producing and approving documents, iterations can be costly and
involve significant rework. Therefore, after a small number of iterations, it is normal to freeze
parts of the development, such as the specification, and to continue with the later
development stages. Problems are left for later resolution, ignored, or programmed around.
This premature freezing of requirements may mean that the system won’t do what the user
wants. It may also lead to badly structured systems as design problems are circumvented by
implementation tricks.
In principle, the waterfall model should only be used when the requirements are well
understood and unlikely to change radically during system development.
INCREMENTAL model
- based on the idea of developing an initial implementation, exposing this to user comment
and evolving it through several versions until an adequate system has been developed
The problems of incremental development become particularly acute for large, complex,
long-lifetime systems, where different teams develop different parts of the system. Large
systems need a stable framework or architecture and the responsibilities of the different
teams working on parts of the system need to be clearly defined with respect to that
architecture. This must be planned rather than developed incrementally.
REUSE-ORIENTED SOFTWARE ENGINEERING
Reuse-oriented approaches rely on a large base of reusable software components and an
integrating framework for the composition of these components. Sometimes, these
components are systems, referred as commercial off-the-shelf (COTS) systems, that may
provide specific functionality such as word processing or a spreadsheet.
The intermediate stages in a reuse-oriented process are different. These stages are:
1. Component analysis - given the requirements specification, a search is made for
components to implement that specification
2. Requirements modification - the requirements are analysed using information
about the components that have been discovered
3. System design with reuse - the framework of the system is designed, or an existing
framework is reused
4. Development and integration - software that cannot be externally procured is
developed, and the components and COTS systems are integrated to create the new
system
There are 3 types of software components that are used in a reuse-oriented process:
1. Web services that are developed according to service standards
2. Collections of objects that are developed as a package to be integrated with a
component framework such as .NET or J2EE
3. Stand-alone software systems that are configured for use in a particular environment.
Process activities
The 4 process activities of specification, development, validation, and evolution are
organized differently in different development processes. In the waterfall model, they are
organized in sequence, whereas in incremental development they are interleaved.
1. Software specification
- is the process of understanding and defining what services are required from the system
and identifying the constraints on the system’s operation and development
Defect testing and debugging are different processes. Testing establishes the existence of
defects. Debugging is concerned with locating and correcting these defects.
3. Software validation
- is intended to show that a system both conforms to its specification and that it meets the
expectations of the system customer
4. Software evolution
Coping with change
There are 2 approaches that are used to reduce the costs of rework:
1. Change avoidance
2. Change tolerance
PROTOTYPING
- an initial version of a software system that is used to demonstrate concepts
To reduce prototyping costs and accelerate the delivery schedule, you may leave some
functionality out of the prototype. You may decide to relax non-functional requirements such
as response time and memory utilization. Error handling and management may be ignored
unless the objective of the prototype is to establish a user interface.
Advantages:
- customers can use the early increments as prototypes and gain experience that informs
their requirements for later system increments
- customers do not have to wait until the entire system is delivered before they can gain
value from it
- as the highest-priority services are delivered first, the most important system services
receive the most testing
Disadvantages:
- most systems require a set of basic facilities that are used by different parts of the system
- iterative development can also be difficult when a replacement system is being developed.
- the essence of iterative processes is that the specification is developed in conjunction with
the software. However, this conflicts with the procurement model of many organizations,
where the complete system specification is part of the system development contract
There are some types of system where incremental development and delivery is not the best
approach. These are very large systems where development may involve teams working in
different locations, some embedded systems where the software depends on hardware
development and some critical systems where all the requirements must be analysed to
check for interactions that may compromise the safety or security of the system
BOEHM’S SPIRAL MODEL
The main difference between the spiral model and other software process models is its
explicit recognition of risk.
RATIONAL UNIFIED PROCESS (R.U.P)
a phased model that identifies four discrete phases in the software process. However, unlike
the waterfall model where phases are equated with process activities, the phases in the RUP
are more closely related to business rather than technical concerns.
Inception: identify all external entities that will interact with the system
Elaboration: develop an understanding of the problem domain, establish an architectural
framework for the system, develop the project plan, and identify key project risks
Construction: involves system design, programming, and testing
Transition: is concerned with moving the system from the development community to the
user community and making it work in a real environment
The practice perspective on the RUP describes good software engineering practices that are
recommended for use in systems development.
There are 6 recommended practices:
1. Develop software iteratively
2. Manage requirements
3. Use component-based architectures
4. Visually model software
5. Verify software quality
6. Control changes to software
Chapter 3: Agile software
development
The philosophy behind agile methods is reflected in the agile manifesto that was agreed on
by many of the leading developers of these methods. This manifesto states:
Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan
Consequently, agile methods must rely on contracts in which the customer pays for the time
required for system development rather than the development of a specific set of
requirements. So long as all goes well, this benefits both the customer and the developer.
However, if problems arise then there may be difficult disputes over who is to blame and
who should pay for the extra time and resources required to resolve the problems.
There are two questions that should be considered when considering agile methods and
maintenance:
1. Are systems that are developed using an agile approach maintainable, given the
emphasis in the development process of minimizing formal documentation?
2. Can agile methods be used effectively for evolving a system in response to customer
change requests?
The key document is the system requirements document, which tells the software engineer
what the system is supposed to do. Without such knowledge, it is difficult to assess the
impact of proposed system changes.
The main difficulty after software delivery is likely to be keeping customers involved
in the process. Although a customer may be able to justify the fulltime involvement of
a representative during system development, this is less likely during maintenance
where changes are not continuous. Customer representatives are likely to lose
interest in the system.
The other problem that is likely to arise is maintaining continuity of the development
team. Agile methods rely on team members understanding aspects of the system
without having to consult documentation.
Detailed specification: if you need a very detailed plan before starting, use a plan-driven
approach.
Incremental delivery: if you can deliver software in parts and get quick feedback, consider
agile methods.
System size: agile works best with small, co-located teams. Large systems may need a
plan-driven approach.
System type: systems requiring extensive analysis (e.g., real-time systems) usually need a
detailed design and plan-driven approach.
System lifetime: long-lifetime systems may need more design documentation, though agile
critics say such documentation is rarely updated.
Technology support: agile relies on good tools for tracking changes. Without good tools,
more design documentation might be necessary.
Team organization: distributed or outsourced teams may need detailed design documents
for communication.
Cultural issues: traditional engineering cultures prefer plan-based development and
extensive documentation over agile’s informal approach.
Team skill levels: agile methods may require higher skill levels. With less skilled teams, a
detailed design by the best people may be necessary.
Regulation compliance: systems needing external approval usually require detailed
documentation.
EXTREME PROGRAMMING (XP)
Extreme programming (XP) incorporates several practices that align with agile principles:
1. Incremental development: small, frequent system releases based on simple customer
stories guide the inclusion of functionality in each increment.
2. Customer involvement: continuous customer engagement with the development team,
where the customer representative defines acceptance tests.
3. Focus on people: practices like pair programming, collective code ownership, and
sustainable working hours emphasize people over processes.
4. Embracing change: regular system releases, test-first development, refactoring, and
continuous integration accommodate and encourage change.
5. Maintaining simplicity: constant refactoring and simple designs prevent code degeneration
and avoid overcomplicating the system for future changes.
Testing in XP
The key features of testing in XP are:
test-first development
incremental test development from scenarios
user involvement in the test development and validation
use of automated testing frameworks
Pair programming
Advantages:
- supports the idea of collective ownership and responsibility for the system
- acts as an informal review process because each line of code is looked at by at least two
people
- it helps support refactoring, which is a process of software improvement
Examples:
A user shall be able to search the appointments lists for all clinics.
The system shall generate each day, for each clinic, a list of patients who are expected
to attend appointments that day.
NON-FUNCTIONAL REQUIREMENTS
- are not directly concerned with the specific services delivered by the system to its users
Non-functional requirements can originate from three main sources: product characteristics,
organizational policies, and external factors.
Organizational requirements - these are derived from the policies and procedures of the
organizations involved:
- Operational process (system usage)
- Development process (programming languages, development environment)
- Environmental (operating environment of the system)
External requirements - these come from outside the system and its development process,
such as:
- regulatory requirements (compliance for system approval by regulators like central banks)
Metric for specifying non-functional requirements
SOFTWARE REQUIREMENTS DOCUMENT
- is an official statement of what the system developers should implement
CONTEXT MODEL
INTERACTION MODEL
Structural Model
Class diagram
Generalization
Aggregation
Chapter 6: Architectural design
ARCHITECTURAL VIEWS
There are 4 fundamental architectural views:
Logical view: shows the key abstraction in the system as objects or object classes
Process view: shows how, at run-time, the system is composed of interacting processes
Development view: shows how the software is decomposed of interacting processes
Physical view: shows the system hardware and how software components are distributed
across the processors in the system
ARCHITECTURAL PATTERNS
- a stylized, abstract description of good practice, which has been tried and tested in different
systems and environments
Repository architecture
- is suited to applications in which data is generated by one component and used by another
(control systems, management information systems, CAD systems).
Client-server architecture
- is concerned with the static structure of a system and does not show its run-time
organization
Pipe-and-filter architecture
- is a model of the run-time organization of a system where functional transformations
process their inputs and produce outputs
APPLICATION ARCHITECTURES
You can use models of application architectures in several ways, as a:
- starting point for the architectural design process
- design checklist
- way of organizing the work of the development team
- means of assessing components for reuse
- vocabulary for talking about types of applications
Reuse
is possible at several different levels:
1) Abstraction level: you don’t reuse software directly but rather use knowledge of
successful abstractions in the design of your software.
2) Object level: you directly reuse objects from a library rather than writing the code
yourself. To implement this type of reuse, you must find appropriate libraries.
3) Component level: Components are collections of objects and object classes that operate
together to provide related functions and services. An example of component-level reuse is
where you build your user interface using a framework. You add connections to the data to
be displayed and write code to define specific display details such as screen layout and
colours.
4) System level: reuses entire application systems. This usually involves some kind of
configuration of these systems. This may be done by adding and modifying code or by using
the system’s own configuration interface. Most commercial systems are now built in this way
where generic COTS (commercial off-the-shelf) systems are adapted and reused.
Host-targeted development
where software is developed on one computer, but runs on a separate machine
The first goal leads to validation testing, where you expect the system to perform correctly
using a given set of test cases that reflect the system’s expected use.
The second goal leads to defect testing, where the test cases are designed to expose
defects.
Verification: to check that the software meets its stated functional and non-functional
requirements.
Validation: to ensure that the software meets the customer’s expectations
The goal of verification and validation processes is to establish confidence that the software
system is ‘fit for purpose’.
Inspections
When you inspect a system, you use knowledge of the system, its application domain, and
the programming language to discover errors.
There are 3 advantages of software inspection over testing:
1. During testing, errors can mask (hide) other errors.
2. Incomplete versions of a system can be inspected without additional costs.
3. Consider broader quality attributes of a program, such as compliance with standards,
portability, and maintainability.
Inspections are not good for discovering defects that arise because of unexpected
interactions between different parts of a program, timing problems, or problems with
system performance. Furthermore, especially in small companies or development
groups, it can be difficult and expensive to put together a separate inspection team as
all potential members of the team may also be software developers.
Development testing is primarily a defect testing process, where the aim of testing is to
discover bugs in the software
Unit testing
- the process of testing program components, such as methods or object classes.
There are two strategies here that can be effective in helping you choose test cases:
- Partition testing: where you identify groups of inputs that have common characteristics
and should be processed in the same way. You should choose tests from within each of
these groups.
- Guideline-based testing: where you use testing guidelines to choose test cases. These
guidelines reflect previous experience of the kinds of errors that programmers often make
when developing components.
System testing
- involves integrating components to create a version of the system and then testing the
integrated system.
- checks that components are compatible, interact correctly and transfer the right data at the
right time across their interfaces
***
SYSTEM TESTING SHOULD FOCUS ON TESTING THE INTERACTIONS BETWEEN THE
COMPONENTS AND OBJECTS THAT MAKE UP A SYSTEM
***
One of the most important benefits of test-driven development is that it reduces the costs of
regression testing. Regression testing involves running test sets that have successfully
executed after changes have been made to a system.
Regression testing is very expensive and often impractical when a system is manually
tested, as the costs in time and effort are very high. In such situations, you must try and
choose the most relevant tests to re-run and it is easy to miss important tests.
The solution to this is making use of automated testing.
Release testing
- the process of testing a particular release of a system that is intended for use outside of the
development team
- release is for customers and users
There are 2 important distinctions between release testing and system testing:
1. A separate team that has not been involved in the system development should be
responsible for release testing.
2. System testing by the development team should focus on discovering bugs in the
system (defect testing). The objective of release testing is to check that the system
meets its requirements and is good enough for external use (validation testing).
Release testing, therefore, must show that the system delivers its specified functionality,
performance, and dependability, and that it does not fail during normal use. It should
consider all the system requirements, not just the requirements of the end-users of the
system.
Requirements-based testing
- a systematic approach to test case design where you consider each requirement and
derive a set of tests for it
- requirements-based testing is validation rather than defect testing—you are trying to
demonstrate that the system has properly implemented its requirements
EXAMPLE:
If a patient is known to be allergic to any medication, then prescription of that medication
shall result in a warning message being issued to the system user.
If a prescriber chooses to ignore an allergy warning, they shall provide a reason why this
has been ignored
1. Prescribe two drugs that the patient is allergic to. Check that two warnings are correctly
issued
2. Set up a patient record with a known allergy. Prescribe the medication to that the patient
is allergic to, and check that the warning is issued by the system
Scenario testing
- an approach to release testing where you devise typical scenarios of use and use these to
develop test cases for the system.
Performance testing
- is concerned both with demonstrating that the system meets its requirements and
discovering problems and defects in the system
Experience has shown that an effective way to discover defects is to design tests around the
limits of the system. In performance testing, this means stressing the system by making
demands that are outside the design limits of the software. This is known as stress testing.
Circumstances may arise through an unexpected combination of events where the load
placed on the system exceeds the maximum anticipated load. In these circumstances, it is
important that system failure should NOT cause data corruption or unexpected loss of user
services.
Stress testing checks that overloading the system causes it to ‘fail-soft’ rather than collapse
under its load.
User testing
- process in which users or customers provide input and advice on system testing
User testing is important because influences from the user’s environment have an impact on:
- reliability
- performance
- usability
- robustness