AQA 7517, section 4.13.1.1
Writing a program takes more than coding. A systematic approach to solving a problem has several stages, which together are the software development life cycle:
This page covers the first stage, analysis. The others are covered in 4.13.1.2 to 4.13.1.5.
Why analyse first?
You can't solve a problem until you know exactly what it is. If you start coding without knowing what is needed, you may well build something that doesn't do what the users want, and have to throw it away. Mistakes found late are far more expensive to fix than those found early.
Analysis involves three connected tasks:
- Defining the problem.
- Establishing the requirements of the system that will solve it.
- Creating a data model.
1. Defining the problem
State clearly what the problem is, who is affected, and what the boundaries of the project are (what is, and is not, included). A good problem definition is specific and agreed.
Weak: "Improve the library." Better: "Replace the paper book-lending register with a system that records who has borrowed each book and when it is due back, and lists overdue books."
2. Establishing the requirements
The requirements describe what the system must do. They must be established by interaction with the intended users of the system, because they are the ones who know what they need.
Ways of finding out
| Method | What it involves | Good for | Weakness |
|---|---|---|---|
| Interview | Asking users questions face to face | Detailed, in-depth answers | Time-consuming |
| Questionnaire | A set of written questions to many users | Collecting views from many people | Limited depth, people may not answer |
| Observation | Watching how people currently do the task | Seeing what really happens | People may behave differently when watched |
| Studying documents | Looking at existing forms, reports and records | Learning what data is used | May be out of date |
Types of requirement
- Functional requirements: what the system must do, such as "record the date a book is borrowed" or "list all overdue loans".
- Non-functional requirements: how well it must do it, such as speed ("a search must take under 2 seconds"), ease of use, reliability, security and the hardware it must run on.
A good requirement is clear, testable (you can check whether it has been met) and agreed with the users. The agreed list forms the requirements specification, which is used later to design, test and evaluate the system.
3. Creating a data model
The system will store and process data, so analysis includes working out what data is needed and how it is organised: a data model. You use abstraction (4.4.1.3) to model aspects of the external world in a program, keeping only the details that matter.
For the library, the model might identify:
- the entities: Student, Book, Loan;
- their attributes: a book has an ISBN, title and author;
- the relationships: a student borrows many books, which is resolved with a Loan entity (see 4.10.1).
STUDENT (StudentID, Name, TutorGroup)
BOOK (ISBN, Title, Author)
LOAN (StudentID, ISBN, DateBorrowed, DateDue)
Other tools used in analysis include a data dictionary (a list of each data item, its type and its rules) and diagrams showing how data flows around the system.
Prototyping and agile approaches
Users often don't know exactly what they want until they see something. Showing them an early version, through prototyping or an agile approach, is often the best way to pin the requirements down.
Prototyping
A prototype is an early, simplified version of the system (or part of it, such as a screen mock-up) that is built quickly and shown to users.
- Users can react to something real, and say what is right and wrong.
- Misunderstandings are found early, before the full system is built.
- The prototype may be thrown away, or developed further.
Agile
An agile approach builds the system in short, repeated cycles (often called sprints), each producing a working part of the system.
- The users are involved throughout and give feedback on each part.
- Requirements can change as the project goes on, and the plan adapts.
- Working software is delivered early and often.
Compared with the waterfall approach
In the waterfall model, each stage is finished completely before the next begins, in one line: analysis, then design, then implementation, then testing. It is orderly and well documented, but it is inflexible, and users may not see anything until the end, when it is costly to change.
| Waterfall | Prototyping / agile | |
|---|---|---|
| Structure | Stages in order, each completed | Repeated, iterative cycles |
| User involvement | At the start and end | Throughout |
| Changing requirements | Difficult and costly | Expected and welcomed |
| First working version | Late | Early |
| Best when | Requirements are clear and fixed | Requirements are unclear or may change |
Worked example
Task: a dentist wants an appointment system. Describe how you would carry out the analysis.
- Define the problem: replace the paper diary with a system to book, move and cancel appointments, and avoid double-booking.
- Establish requirements by speaking to the receptionist (interview, and observing how bookings are made), the dentists (what they need to see), and patients (a questionnaire about how they would like to book). Functional requirements might include "show free slots for a chosen dentist" and "send a reminder"; a non-functional one might be "must be usable by staff after one hour of training".
- Create a data model: entities such as Patient, Dentist and Appointment, with their attributes and relationships (a dentist has many appointments, a patient has many).
- Build a prototype of the booking screen and show it to the receptionist, to check the layout before building the real thing.
Check yourself
Why must a problem be defined and the requirements established before it is solved?
Otherwise the solution may not do what the users need. Finding mistakes later is much more costly than finding them in analysis.
How should the requirements of a system be established?
By interaction with the intended users of the system, for example through interviews, questionnaires and observation.
What is the difference between a functional and a non-functional requirement?
A functional requirement says what the system must do. A non-functional requirement says how well it must do it, such as its speed, reliability, security or ease of use.
What is a prototype, and why is one used in analysis?
An early, simplified version of the system, shown to users so that they can give feedback. It clarifies the requirements and finds misunderstandings early.