Lecture 3 - Introduction to Software Development
Home
Objectives
- To introduce students to the role of the programmer and the steps in software
development
- To introduce students to Defining Diagrams
Contents
- Why do we need Programs?
- Alternatives to Writing Programs
- What to Programmers do?
- Basic Operations of a Computer
- Software Development/Construction
- Construction a Building
- Constructing Software: Steps in Software Development
- Defining Diagrams
- Understand the Problem
- Specify a High Level Solution
- Key Points
- Further Reading
- What's Next
1. Why do we need Programs?
Programs are needed for problems that:
- store, access or process moderate to large amounts of data
- involve complex and/or large amounts of processing
- require communications
2. Alternatives to Writing Programs
Writing a program isn't always the best solution to a problem. There should be
a good reason to write a program.
Some alternatives
- manual systems: some problems are not complex enough to warrant a program
- using software packages to create a solution
- packages: Sometimes a suitable package is available. This is usually far less
expensive than writing the software, and has the advantage that staff may already
be trained in its use, training may be available etc.
- Modifying existing packages: customization of a package may be necessary to
provide the required functionality (this is not always available).
Advantages of Writing Software
- should match user requirements
- flexibility
- may provide an advantage over competitors
- may be no other alternative
Disadvantages of Writing Software
- cost, cost, cost. Writing good software is generally very expensive compared
to packaged software
- expertise required to write and maintain
- may not deliver what was required, or may not deliver at all
Advantages of using Packages
- reduced cost and maintenance
- possible training/classes
- pool of expertise/help, staff may already be trained in the package
- standardization
3. What do Programmers do?
Programmers don't spend all day coding programs. Their duties vary widely, with
programming typically being an important part of there duties, but far from taking
the majority of their time.
To be able to write a program programmers need to:
- Talk with clients to find out their requirements
- Understand the problem to be solved
- Design a solution to the problem
- Construct a solution (write a program)
- Test the solution to the problem
- Enhance and maintain the solution
Along the way programmers will:
- Use programming tools to document and build the system
- Make use of resources such as on-line help, reference manuals, WWW, ...
- Talk with management, other programmers, technical consultants, ...
- Consider issues such as the user interface
4. Basic Operations of a Computer
To be able to write computer programs we need to be aware of what a computer can
do. In broad terms the basic operations that can be performed on a computer are:
1. Get information
- A computer can get information from the user (e.g. via a keyboard) or from
a file and store it in a named location in memory.
2. Output information
- A computer can display information to a screen, print information to a printer
or write information to a file.
3. Perform calculations
- A computer can do calculations such as addition and multiplication
4. Store data to memory
- A computer can store data to a named memory location.
5. Retrieve data from memory
- A computer can retrieve data from a named memory location
6. Decide between alternative instructions
- A computer can make a choice between two alternatives based on a condition.
7. Repeat instructions
- A computer can repeat a series of instructions, until some ending condition
is met.
5. Software Development/Construction
Computer software can be incredibly complex, with some system being in excess of
20 million lines of code! We will be looking at very small programs in this subject,
however many of the same principles apply to small and large systems.
Many people in the class won't have programmed before. While many people won't
have programmed, it can be useful to give an overview of what software development
is about. Creating software has many parallels with constructing a building.
We'll look at the steps involved in constructing a building to help gain in insight
into the processes that are undergone when constructing software and why the
steps are needed.
5.1 Constructing a Building
Some of the things that may be done are:
1. Feasibility study
2. Concept planning
3. Design
4. Building
5. Handover
6. Maintenance
5.2 Constructing Software: Steps in Software Development
Systems or programs of any size have similar phases or steps. The following steps
are based on Robertson p2-3. The words in italics are tools and techniques used
by programmers that will be discussed in more detail later in this subject.
1. Define the problem
- The problem to be solved must be clearly understood before trying to develop
a solution. Otherwise you might be designing a banking system instead of a arcade
game
2. Specify a high level solution
- It is usually impractical to immediately develop a detailed solution to complex
problems. Instead an outline is developed that specifies a high-level solution
keeping the problem at a manageable level of complexity.
- Defining Diagrams will be used in this subject to express the problem
at a high level
3. Outline the solution
- If the problem is complex, details not specified in the high level solution
above can be specified.
4. Develop the outline into an algorithm
- A more detailed algorithm (a series of steps to be performed) is developed
that specifies what is to be done and how it is to work. This is usually done
in an English like manner that is precise and understandable so that it can easily
be converted into program code.
- Pseudo Code and Data Dictionaries are used to design and document
the algorithm
5. Test the algorithm for correctness
- The algorithm needs to be checked to see if it meets the users requirements.
As the program is yet to be developed, the algorithm is manually checked (on
paper).
- Desk Checking is performed to check the algorithm against specifications
6. Code the algorithm into a specific programming language
- Write the program based on the Pseudo Code and Data Dictionaries.
- Knowledge of a programming language such as Visual Basic or Java is
needed to write the program code. Tools such as Editors and Compilers are
used to construct the program.
- The type of computer and operating system that the program will run on may
affect the choice of programming languages and tools used. Programmers need to
understand and be able to use multiple operating systems
- We will look at the operating systems: MS Windows and UNIX
7. Test the program
- The program is run and checked against data that has been designed to test
that the program works correctly.
- Test Plans specify the test data to be used and the correct outcomes.
8. Debug the program
- If the program doesn't work correctly the algorithm and code need to be checked.
- One method is to use a Debugger to see how a program works while it
is running and help locate the error (bug).
9. Document and maintain the program
- Programs are usually added to, enhanced and updated over time, so it is important
that they are easy to understand
- Comments inside a program help someone reading the program understand
how it works
A disciplined approach to software development saves money and builds more reliable
software.
The above terms will be introduced/covered in this subject in more detail.
6. Defining Diagrams
Before writing a detailed solution to a problem, it is essential that the problem
to be solved is understood.
We will be using Defining Diagrams to provide and give an overview of the
problem. Defining Diagrams are used to broadly state what is to be used (inputs),
and what is to be done (processing) to solve the problem, and the results (outputs).
In the following example we will look at the first 2 steps in software construction:
Define the problem and outline the solution.
Problem Description
Input two numbers, add the two numbers together and display their total.
Example Program Runs
An example run represents a generic run of the program using a simple user interface.
A real program run, when implemented in a particular programming language may
look different (e.g. it may use input boxes or dialog boxes, buttons etc), but
should do the same task.
A number of conventions will be used to aid in understanding example program
runs:
- Run will be used to indicate that the program is to be executed
- Input prompts will normally be indicated by the variable name followed by a
question mark (?)
- Values input by the user will be shown in bold and italics
- Variables displayed by the user will usually be in the format variable-name
= variable-value
Example Program Run
Run
Number 1 ? 10
Number 2 ? 3
Total = 13
Note: This is a simple problem, however it allows the concepts and techniques used
to be demonstrated.
6.1 Understand the Problem
Step 1a: Carefully read the problem, a number of times if necessary, writing down
any key information, highlighting keywords etc.
Step 1b: Check your understanding of the problem.
This is an important step. All too often, problems occur in later steps because
the programmer didn't really understand what was required.
6.2 Specify a High Level Solution (Defining Diagram)
Study the problem identifying the inputs, processing and outputs.
Inputs and outputs are usually the things being acted on and are usually
referred to by descriptive words e.g. two numbers, total
The processing required is usually indicated by verbs - indicating the actions
to be performed e.g. input, add, display
Step 2a: Determine the outputs (result) required:
It is often easiest to identify the output(s) for a problem.
Step 2b: What processing is required to get to obtain the result:
Step 2c: What inputs are needed:
What is the least amount of information that must be supplied by the user.
If the information can be provided by another source (e.g. calculation) then
don't ask the user. The two numbers to be added can only be obtained from the
user, there is no other way to get them.
Step 2d: Develop the Defining Diagram
Defining Diagram
The defining diagram provides a high level outline of the algorithm and data used.
For most problems it isn't feasible or wise to leap straight into pseudo code
or program code - defining diagrams allow the programmer to broadly specify what
is to be done without getting immersed in too much detail. Keeping complexity
to a minimum is essential if larger problems are to be successfully tackled.
The next steps in software development will be covered in the next few lectures.
Key Points
Further Reading
- Defining Diagram Guide
- Robertson, L. A. (2003) Simple Program Design: A Step-by-Step Approach. 4th
ed. Melbourne: Thomson. (Simple Program Design is only book I have seen
that tackles program design and does so in an approachable way. It covers program
design in a general manner with plenty of examples, rather than trying to teach
a programming language. I believe that you will find it useful in introductory
programming subjects)
Written by Tim Whitfort.