0% found this document useful (0 votes)
4 views9 pages

Chapter 1 Program Design

The document provides an overview of computer systems, including components such as hardware, software, human ware, firmware, and bridge ware. It outlines the program development process, emphasizing the importance of defining problems, outlining solutions, and utilizing algorithms and pseudocode. Additionally, it discusses programming methodologies and data types, highlighting the significance of data validation in programming.

Uploaded by

sqomoyi0
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views9 pages

Chapter 1 Program Design

The document provides an overview of computer systems, including components such as hardware, software, human ware, firmware, and bridge ware. It outlines the program development process, emphasizing the importance of defining problems, outlining solutions, and utilizing algorithms and pseudocode. Additionally, it discusses programming methodologies and data types, highlighting the significance of data validation in programming.

Uploaded by

sqomoyi0
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Learning Unit 1

Objectives

• To describe the steps in the program development process

• To introduce current program design methodology

• To introduce procedural and object-oriented programming

• To introduce algorithms and pseudocode

• To describe program data

BACKGROUND: We are now living in a computer age. Computers are influencing every aspect of our
lives. They are used in offices, banks, supermarkets, hospitals and even in games we play.

1.1 What is a Computer?


The computer is a specialised tool used to produce information. In simple terms, the computer
can be considered as an electronic machine that helps us to process information. Information,
in a suitable form, is the basis of our knowledge itself. So, the computer is a remarkable tool.
So conclusively we can define as an electronic device that uses a set of instructions
(program) to accept input (data), process it and produce output (information).

1.2 The Concept of a System

System is a word we use almost every day. It also occurs in combination with many other words. We
hear of “Telephone Systems”, “Nervous System” or “Economic System”. What does the word system
mean? The Oxford English Dictionary gives the following definitions of the word system.

“An organised or connected group of objects. A set or assemblage of things connected, associated or
independent, so as to form a complex unity. A whole composed of parts in orderly management
according to some scheme or plan…… The set of correlated principles, ideas or statements
belonging to some department of knowledge or belief considered as an organised whole. An
organised scheme or plan of action. An orderly or regular method of procedure….”

We can say that a system is a collection of interdependent components, which operate together
as a whole, producing one or more results.

The word system is frequently used in the study of computers. Let us try to explain how this word fits
into our field of study.

1.2.1 A Computer as a System of Components

A computer system is made up of a variety of components. Basically, a computer system consists of


these subsystems. These are

• A hardware subsystem
• A software subsystem
• Human ware
• Firmware
• Bridge ware

The hardware subsystem

This can be further be broken down into the following components:

• Peripherals
• External Storage
• System Unit

Peripherals include all input devices, output devices and the secondary storage devices attached to
the computer. For example, the keyboard is an input device, the monitor is an output device and the
hard disk is a secondary storage device. All of these are peripherals of the hardware subsystem.

External storage (sometimes called secondary memory) are devices on which data can be stored for
long term use. They are not always permanently connected to the computer. Magnetic tapes,
magnetic disks and optical disks belong to this category.

The system unit is a subsystem in which processing and temporary storage of data takes place.
Inside the system unit, there are various subsystems that work together to process data.

Other types of hardware such as flash sticks, voice inputs, tablets and cellphones. All these different
subsystems are linked to each other by one or more special connectors called buses. A bus is a
device designed for the high-speed transfer of electronic signals. A hardware subsystem can best be
illustrated by the following diagram. The arrow represents the flow of data and information between
the different components of the hardware subsystem.

EXTERNAL

MEMORY

INPUT SYSTEM OUTPUT

PERIPHERALS UNIT PERIPHERALS

The software subsystem

The software subsystem of a computer system consists of computer programs.

A computer program is a set of instructions to the computer to perform a specific task.

The computer is a machine that has no intelligence of its own and so must be provided with detailed
instructions of what to do and how and when to do it. This set of instructions is known as the software.
Without the software, the computer will not be able to perform any task.

Software can be divided into two broad categories:

• System Software
• Applications Software
The software that is designed to control, support, manage and operate the components of the
computer itself is called System Software. This kind of software does not perform any specific task
relating to a business or profession. The operating system of a computer, translators and utility
programs belong to this category. The common operating systems are WindowsXP, Windows2000,
and Linux etc.

The programs that are designed to carry out a user’s specific tasks are called Applications Software. A
payroll program, a word processor, a spreadsheet, a desktop publishing program and a database
management system belong to this category of software. A completely different application is in the
control engineering industry where application software is used to control electronic machines. Other
types of software can be music creation programs, simulation programs and art creation programs

The Human ware

The man-machine interface is called human ware. The people who work with the computer are
collectively called the human ware or livewire.

The Firmware

The computer programs permanently stored in ROM or PROM are called firmware. These programs
are provided by hardware manufacturer along with the computers. Generally these are booting
programs which help in the starting of a computer. Such programs cannot be erased or overwritten.

The Bridge ware

The computer components and programs used to translate instructions and information written for
one type of computer into a format that another type of computer can understand is called bridge
ware. This is necessary because different computers are made by different manufacturers.

In a data processing system, data which is input is changed to the required output by a process. The
process consists of a set of instructions provided by a computer programmer.

1.3 The major phases of a computer software application

“Any computer application consists of the following 3 phases:

INPUT PROCESSING OUTPUT

OR

DATA PROCESSING INFORMATION


We need some input to be processed in order to produce the required output. Data as
well as instructions are fed through an input unit such as the keyboard or magnetic disk
into the computer. The computer then processes the data through its Central Processing
Unit or CPU. The processed data is called information. We can display the output on the
screen, print it on paper or store it on a disk. Apart from input, processing and output, a
computer system also has storage. Data and instructions are usually stored on external
storage such as a diskette or a hard disk. While the program is executed, the computer
transfers instructions and data to its primary or main memory, so that it can use them
easily.” (Erasmus et al 2002, p.4)

If we consider an information system, the data is the input of the system and information forms the
output of the system. The software, personnel and procedures together represent the process
component of the system.

In simple terms, the following definition can be used to explain the difference between data and
information: Information = Data + Structure

Consider the following numbers: 19920230

It is impossible for us to guess what the above numbers represent. Similar values, that have little or
no meaning to the user, may be called data. Let us apply some structure to the above data. If we are
told that the first value represents the Year and the second Month, and Date, [ YYYY-MM-DD ]. The
numbers acquire meaning to the person who reads them. Now that structure has been applied to the
data, it has meaning and it is called information.

We can now also use computers and programs to create music, art, movies, stories, etc.

Steps in program development


Computer programming is an art that does not require one to be good at mathematics, or to have a
memory for figures and technical information. With the right tools and steps to follow, anyone can
write well-designed programs. It is a task worth doing, as it is both stimulating and fulfilling.

What is programming?

Programming can be defined as the development of a solution to an identified problem, and the
setting up of a related series of instructions that, when directed through computer hardware, will
produce the desired results. There are seven basic steps in the development of a program, as
follows:

1. Define the problem: This step involves carefully reading and rereading the problem until you
understand completely what is required. The problem is divided into Input, Output and
process.
2. Outline the solution: Upon defining the problem, you may decide to break it down into
smaller tasks or steps, and establish a solution [Link] solution may include major
processes; major subtasks; user interface; major control structures; major variables and
record structures;mainline logic.
3. Develop the outline into an algorithm: The solution is then expanded into an algorithm. An
algorithm set of precise steps that describe exactly the tasks to be performed and the order in
which they are to be carried out.
4. Test the algorithm for correctness: This step is one of the most important in the
development of a program. The main purpose of desk checking the algorithm is to identify
major logic errors early, so that they may be easily corrected.
5. Code the algorithm into a specific programming language
6. Run the program on the computer: A program compiler and programmer-designed test
data to machine test the code for syntax errors. This can be performed several times until the
program is running as required
7. Document and maintain the program: Program documentation should not be listed as the
last step in the program development process, as it is really an ongoing task from the initial
definition of the problem to the final test result. Documentation includes both external
documentation and internal documentation.

Program design methodology


The most common program design methodologies are: • procedure-driven • event-driven • data-
driven.

Procedure-driven program design:

Is based on what it does – its processes or functions. The programmer will focus on the processes
breaking the functions into smaller and more specific flows of data.

Event-driven program design:

Is based on the idea that an event or interaction triggers a program.

Data-driven program design:

Is based on the idea that the data in a program is more stable than the processes involved. It
analyses data and the relationships between the data for data structures.

Procedural versus object-oriented programming


Procedural programming is based on a structured, top-down approach to writing effective programs.
The problem is usually broken down (decomposed) into separate tasks or functions using top-down
development and modular design approaches.

• top-down development: a general solution to the problem is outlined first. The outline is then
divided gradually into more detailed steps until finally the most detailed levels have been
completed.
• modular design: involves grouping tasks together that perform the same function

Object-oriented programming is also based on breaking down the problem (decompositioning);


however, the primary focus is on the things (or objects) that make up the program. So the program is
concerned with how the objects behave.

An introduction to algorithms and pseudocode


A program must be systematically and properly designed before coding.

What is an algorithm?

An algorithm set of precise steps that describe exactly the tasks to be performed and the
order in which they are to be carried out.
Algorithm can be defined in programming terms as a set of detailed, unambiguous and
ordered instructions developed to describe the processes necessary to produce the desired
output from a given input.

An algorithm must:

• be lucid, precise and unambiguous

• give the correct solution in all cases

• eventually end

Example: listing of prices on a pocket calculator

Steps that are not repeated are not indented…like (Turn on calculator)

Repeated (entering and summing the prices) are indented.

What is pseudocode?
Pseudocode and flowcharts are both popular ways of representing algorithms. Pseudocode is
structured English. It is English that has been formalised and abbreviated to look like the high-level
computer languages. It has no standard for pseudocode at present. Pseudocode has certain
conventions:

1. Statements are written in simple English.


2. Each instruction is written on a separate line.
3. Keywords and indentation are used to signify particular control structures.
4. Each set of instructions is written from top to bottom, with only one entry and one exit.
5. Groups of statements may be formed into modules, and that module given a name

Program data
Data within a program may be a single variable, such as an integer or a character, or a group item
(sometimes called an aggregate), such as an array or a file.

• A variable is the name given to a collection of memory cells designed to store a particular
data item. Example: SUM_TOTAL or DP
• A constant is a data item with a name and a value that remain the same during the execution
of the program.
• A literal is a constant whose name is the written representation of its value.
DATA TYPES

The data types can be elementary data items or data structures.

• integer: representing a set of whole numbers, positive, negative or zero e.g. 3, 576, –5
• real: representing a set of numbers, positive or negative, which may include values before or
after a decimal point. These are sometimes referred to as floating point numbers e.g. 19.2,
1.92E+01, –0.01
• character: representing the set of characters on the keyboard, plus some special characters
e.g. ‘A’, ‘b’, ‘$’
• Boolean: representing a control flag or switch that may contain one of only two possible
values, true or false

DATA STRUCTURES

A data structure is a structure that is made up of other data items.

record: a collection of data items or fi elds that all bear some relationship to one another. For
example, a student record may contain the student’s number, name, address and enrolled subjects.
file: a collection of related records.

array: a data structure that is made up of a number of variables or data items that all have the same
data type and are accessed by the same name. For example, an array called scores may contain a
collection of students’ exam scores. Access to the individual items in the array is made by the use of
an index or subscript beside the name of the array. For example, scores (3) represents the third score
in the array called scores.

string: a collection of characters that can be fixed or variable. For example, the string Jenny Parker
may represent a student’s name.

FILES
A popular method of storing information is to enter and store data in a file. There are several major
advantages of using files:

• Several different programs can access the same data.


• The data can be entered and reused several times.
• The data can be easily updated and maintained.
• The accuracy of the data is easier to enforce.

There are two types of files in which data can be stored: sequential or text files and direct or random
access.

Data validation
Data should always undergo a validation check before it is processed by a program.

• Correct type
• Correct range
• Correct length
• Completeness
• Correct date

You might also like