0% found this document useful (0 votes)
3 views11 pages

Introduction To Programming

The document provides an overview of programming, detailing what a program is, its main functions, and the six stages of the program development cycle: requirement specification, program design, coding, testing and debugging, documentation, and implementation. It emphasizes the importance of program qualities such as accuracy, reliability, efficiency, and maintainability, as well as the organization of data and the structure of programs. Additionally, it discusses methods for fact-finding, structured program design, and the significance of documentation in programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views11 pages

Introduction To Programming

The document provides an overview of programming, detailing what a program is, its main functions, and the six stages of the program development cycle: requirement specification, program design, coding, testing and debugging, documentation, and implementation. It emphasizes the importance of program qualities such as accuracy, reliability, efficiency, and maintainability, as well as the organization of data and the structure of programs. Additionally, it discusses methods for fact-finding, structured program design, and the significance of documentation in programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

INTRODUCTION TO PROGRAMMING

What is a program?

A computer program is user software usually written by a programmer to solve user problems in a
computer

It consist of a sequence of statements (instructions) in order to carry out a define task

Main functions of a program

To process data (information)

Functions of a program

 Accepting data from outside the computer as its input


 Carry’s out a set of processes on the data within the computer memory
 Stores the data for future use and;
 Present the results of this processing as its out put

Memory

Program
(instructions)

Central processing unit

Input data

(From outside) Data (unprocessed information)

Program development Sacco


The six stages of program development cycle are referred to as the program development
Sacco 1

Diagram

Requirement specification

Program design

Coding

Testing and debugging

Documentation

Implementation

Requirements specification

States the function of the [Link] involves the definition of inputs transformations, outputs and
treatments of exceptional statements

Program design-is a crucial stage in which the programmer identifies the processing tasks required, and
the precise order in which they are to be carried out, that is the algorithm from which the computer
program will be produced, the design process takes little/ no account of the programming language to
be used in the final product since the emphasis is on defining program logic at this stage

Coding the program

After having designed the program logic structure of the program the programmer’s next task is to
convert the design specification (the algorithm) in to actual computer instructions in the computer
language to be used. If sufficient care has been taken at design stage coding is an almost mechanical
process for an experienced programmer; since most of the hard work of analyzing the problem and
breaking it in to a sequence of small simple steps has already been done during the design stage

Testing and debugging


Debugging is the detection and correction of errors that may exist in the
program. The only way to be completely confident that a program will behave
as expected, under all circumstances that can conceivably arise, is to test the
program thoroughly before implementing it. Program testing involve creating
taste data designed to produce predictable output and comparing the actual
output with the predicted out put
Documentation having written tasted and debugged a program it must be documented. There are two
types of documentation:

User guide which are intended to help the user to help the program that is, to operate it with minimal/
no guidance

Technical manuals which are intended for system analyses/programmers to enable maintenance and
modification of the program designed and record

Implementation – At this stage the system designers will actually install the new system, create data
files and train people to use the system. A common practice is to run the new system with parallel to old
system to ensure that if something goes wrong the system

After a number of successful parallel lines, the old system will be abandoned and the new system will
become fully operational

At this point, the system goes in to the final stage of monitoring and review (evaluation) where the
performance of the system is evaluated with reference to initial requirements

Qualities of a good program

It has the following characteristics:

Accuracy

-the program must do what is supposed to do, and meet the criteria let down in
its specification

Reliability-the program must do what it is supposed to do and never crush

Efficiency-the program must use the available storage based and resources in
such a way that the system must be uploaded

Robertsness- the program should cop with invalid data without creating errors

Usability-the program must be easy to use and well documented


Maintainability – the program must be easy to amend having good structure and
documentation

Readability-the code in the program must be well laid out and explained with
comments

Data and data structures

Uses

One of the most important ingredients of any program is its efficiency. In many
real time environments (e.g. patient moldering system efficiency is critically
important in the real time use)

Data must be organized in a logical and consistent way if it is to be of any use. All
data must have a structure, and this means that we can link individual data items
in to larger that have some item. E.g. an address book is a data structure
containing data items (mane, address phone number) logically grouped together
to give information to an individual

The efficiency of a program is the measure of unknown of resources consumed in


a program. Traditionally the resources were considered (where data is stored)
since computer time and storage

Types of data

There are two fundamental types of data

Numeric data –is divided in to two main groups

Integers and reels

Integers are whole numbers used to count things (such as no of days in a year), /
oranges in a buckets e.g. 0, 1, 170, 8,-3. Real numbers may have a fraction part
and are used to measure things such as the length of a string or the cost of an
item (2.1,-41.6, and 0.126)

Non-numeric data-are character strings (like hello/ logical values to stand for
yes/no conditions). Other non-numeric type exist such as pointers (which stores
addresses of variables and dates (which allow arithmetic operations when
calendar dates)
FILES AND RECORDS

A structure becomes more complex the relationship becomes also complex and requires further
organization into larger groups of related items such as records and files

A data record is a group of related items that we can read as a single group this the name address and
full number in the address book are related files that form a group / address book.

The data items in a record can be of different types a collection of this records form a file

An example of an address book

Name Address Phone


Maurine simiyu 5676 nakuru 0789654316
Sabinaatieno 2345 nyeri 0789984741
Salomewamalwa 423 lamu 0703808130
Collins wafula 7465 nyahururu 0711296626
David omondi 8776 karatina 0714824567

Row (records)

Column (fields) files

Data hierarchy

Data can be organized and stored in various ways depending on user requirements and the program
efficiency

Data base

Logical collection of files

Collection of records

Collection of fields

Fields, facts, attributes

Character, alphabetic, numeric, / special characters

Data hierarchy –the basic element that is stored in the computer is a character. A group of characters in
computer is fields. A field is a column of similar information/groups of vertically arranged data that
contain similar information of data type example, in an address book, the column / fields will be named
address and phone. A group of fields form a record and several records combined to form a file; one /
more related files contain a collection of information organized and present a specific purpose to form a
data base

REQUIREMENT SPECIFICATION

OBJECTIVE – to describe in documentary form essentials operational of the user out of this work comes
a definition of the output required from the system, input need to generate the output information the
processing requirements in the operational specification

Fact finding techniques

It involves gathering of all information required to implement a computer system

Commonly used method

Interviewing- is the process of obtaining information without upsetting the other party by means of
conversation

Planning for an interview

Clarify the problem and what is to be investigated

Find as much as possible about the subject area

Prepare a list of main questions

Ensure authority to interview has been interviewed

Conducting an interview

Ensure that the interviewee is at easy before embarking on the main fact finding

Let the interviewee tell his own story in his own words

Do not ask leading questions

Ask one question at a time

Keep the sequence of questions logical

Avoid the role of an expert

Be straight forward and frank

Ensure that the answers are fully understood

Try to quantify vague references to percentage


End the interview on a pleasant/constructive note

After the interview

Record the data at the earliest opportunity

Check the facts as soon as possible

Get agreement on the files

Questionnaire

It may be the most packable method of fact finding where

Information is located over a wide spread geographical area

A large number of people are required to vanish the data

Verification of data found by other means is required

100% coverage is not essential

The three basic designs of questionnaires

Heading section which will display the purpose of the questionnaire and contain the main references
e.g. name, date etc. .

Classification section which will contain data to be used for analyzing and summarizing the total data e.g
sex, age

Data section which will contain the data being sort

Observation- this method involves watching an operation for a period of time to see for one cell what
exactly happens

Document review- is used for understanding the structure of the organization its operation and its
history of the system

User workshop- this method gets the user ti participate in the analysis and has become very popular in
recent years

NOTE it is not uncommon to use a combination of methods. Example, interviewing key users and
sending a questionnaire to all participants prior to holding a user workshop

Structured program design

The first programs that were written were not structured


The program usually consist of a sequence of individual instructions that were executed
one after the other

Why structure structuring a program helps to break it down into understandable


chunks. Structure design cannot reduce the overall complex of the system but it break it
down in to smaller chunks(nodules), which means that the amount of code that the
programmer has to deal with for any one module is much less than dealing with the
system as a whole

Reuse modules that contain standard procedures throughout the program saving
development time

Testing of individual modules in isolation, makes tracing mistakes easier

Amendments to single modules do not affect the rest of the program

Ability to create libraries of often use routines which are reliable and can go in to other
programs

Modules can be named in such a way that they are easy to find in documentation and
consistent

Top down approach

The program design process is frequently tackled by adopting the top down
[Link] outline program is designed first showing the main task/ components of
the program and the order in which they are to be executed e.g.

Exam result-consider a class of twenty students who sat for examination in four
subjects. A student must get an average of 50%in all four subjects to pass. A report is
required that we show the max of each student per subject, the average max and
whether the student has passed of not. The structure of the report to be designed is
shown below

Exam results-2000
AVERAGE PASSFAIL
SUBJECTS MARK
MThs Eng. GHC Science
Cynthia 56 45 40 55 195 pass
Allan 20 38 33 40 112 fail
Joshua 10 17 29 22 66 fail
Titus 50 45 56 55 244 pass

Sabina 34 12 19 20 fail
Structure chats- shows the overall frame of the program, with each level show progressively
more detail. The program is separated in to module one for each main function. Modules are developed
starting from the top and moving down the hierarchy. This method ensures that all modules link in
together as the program develops

Structure chats are used mainly to show relationship between program modules and graphically
depicts the breakdown of modules

Design of exam result using structure chats

PSEUDOCODE/ENGLISH

PSEDUCODE IS USUALLY PRECIDED BY A HIERACHY OF MODULES USING A STRUCTURE CHATS

FLOWCHARTS

Are used to represent any way difference sequence of activities

They are used to convey in diagrammatic form the logic processing operations and control required
required by a computer program

Selling price

Things become clearer:

ADDVAT to cost price giving selling price

RULES FOR DATA CODES

Use names that describe the purpose of the code/variable

Don’t make up aliases

Don’t use names that are similar change at least two letters?--

Keep spellings as normal as possible student-name rather than studied-NAM. If the language rules
don’t allow long names then use abbreviation constantly [Link]
Use the same prefix for the same variable in one record/the local variable in a subroutine

Comments-helps to make the program code more understandable. All programming languages allow
the user of comments in a program

Indentation- allow the use of comments in a program code should be laid out with proper use of
indentation to reflect the logic structure of the code

Avoid tricks- always make sure that the program is written using straightforward code which people
can readily understand

Modularization – the aim of splitting up a program is to make it easier to understand

It also reduces the effort required to change the program

RULES

Each module should contain only one program function the maximum size for each module should be
about one hundred instructions

There should only be one entry point and one exit point in every module

Program generators-is used to reduce the program development time

It is software utility which has been specifically design the task of creating report first and easy

Testing and debugging

Testing –is part of the procedures that ensure the program corresponds with the original specification
and that it works in its intendedenvironment

Debugging- process of running software to find errors through its possible that some errors

TYPES OF ERRORS
There are two main types of errors in programs in computer

Syntax error (error in the user programing language)

1. Logical errors
2. Errors in the program logic

Program testing

There are several stages in testing a program


I. Test checking
The programmer goes through the program on paper to pick any logic errors that would always
cause
II. Compiler
III. Program running test data
IV. Diagnostic procedures
V.
VI. Full scale/ system tested with actual data

Programming documentation- is a critical of any serious program package. A general purpose program
such as a spread sheet, designed for people who just want to use computer as a tool will require detail
instruction regarding its function and use

Reasons for documentation

Communication purpose

Quality control purpose

Documentation checklist

Identification – includes the title of the program short statement of its program, language used and
program

General specification- should include the description of the main action of the program, description of
main actions, files specifications, restrictions and limitations of the program

User information- this should include the information of input required,e.g. source documents, how to
produce their layout and detail instruction on how to lay the program

Program specification

This will contain the designer of the program using designed chats.

You might also like