You are on page 1of 14

Introduction to Computer Programming

Introduction
• In today’s IT driven business era, Managers must
understand the working of software, which is the
driving force of IT.
• Understanding software programming helps the
managers to develop problem solving skills using
computers, to know what software development
is and what software developer do.
• It helps Managers to be familiar with
programming concepts and terminology to
facilitate communication with software
developers.
Program Development Life Cycle
• Problem Definition
• Requirement Analysis
• Designing a program model
• Determining correctness of the program
• Coding the Program
• Testing and debugging the program
• Documenting the program
Problem Definition
• Generally the problems in real life are not precise
and sometimes may be ambiguous.
• To obtain solutions for such problems we need to
define problem specifically. The problem must be
clearly understood as to what must be done
rather than how to do it.
• The problem definition should be in user’s
language and should be described from the user’s
point of view. It should not be stated in technical/
computer terms.
Requirement Analysis
• An explicit set of requirements is important as they
help to ensure that the user and not the programmer
drives the program’s functionality.
• Only if the requirements are explicit the user can
review them and agree to them, which reduces the
burden on programmer to guess what the user wants.
• Specifying requirements adequately is a key to the
program’s success.
• Essentially, we must look at three main components
1.What is given as input
2.What is expected as output
3.How to arrive at the solution
Example
A program is required to retrieve motor
vehicle registration records from a file upon
receipt of a request from an operator at a
terminal. The operator will supply a vehicle
registration number and the program will
display the details of its vehicle and its owner.
An error message will be displayed if the
program is unable to locate the vehicle’s
record.
Example…
• Input :-Vehicle Registration number
• Process :-Using the registration number, search
for it , and if found, retrieve the details of the
vehicle and it’s owner’s name from the disk.
• Output :- If retrieval was successful, then allow
the details of the vehicle to be displayed on the
screen but if unsuccessful, indicate the absence
of the vehicle registration on the disk and display
a suitable error message
.
Designing a program model
An algorithm is a formula, a recipe, a step by
step procedure to be followed in order to
obtain the solution to a problem. To be useful
as a basis for writing a program, the algorithm
must:
– Arrive at a correct solution within a finite time
– Be clear, precise, unambiguous and
– Be in a format which lends itself to an elegant
implementation in a programming language
Designing a program model

• Tools for preparation of an algorithm


Flowcharts : Provide a visual and graphical
representation of solution
Pseudo codes: writing the program logic in a
simple step by step manner using a English-like
vocabulary.

Logic depicted using these tools can then be written


using any computer programming language.
Determining correctness of algorithm

Ex. Dry run.


Coding the Program

• This is the process of converting the algorithm


(flowchart/pseudocode) into an actual computer program.
• Here we choose a programming language(Machine,
Assembly and High Level) and using the syntax and
semantics of that language, the algorithm expressed in the
form of a flowchart/pseudocode is converted into a
computer program.

Syntax means the correct way or "grammar" of writing a


command and Semantics means the logical meaning of a
statement.
Test and debug the Program
Syntax errors occur when a computer language compiler
cannot understand a command entered by the programmer.
When such an error is encountered the computer rejects the
program and prints out an error message. These errors are
encountered during compilation and are very easy to correct.
In many cases, these errors arise due to spelling mistakes,
missing commas etc., and incorrect syntax.

Execution Errors are encountered after error-free


compilation, at the time of execution of the program.
Execution errors are also called runtime errors. Typical
examples are :
– Infinite loops
– Correct outputs only for selected data
– Division by zero
Test and debug the Program
Logical Errors are due to mistakes made by the programmer
while coding the program. The computer does not detect
logical errors.
For example, for calculating the net salary of an employee the
formula used may be
Net Salary = Basic Salary + Allowances - Deductions

but through oversight, while coding, the formula is written as


Net Salary = Basic Salary - Allowances + Deductions

This will obviously produce a wrong result. Such errors can be


detected only by a dry run.
Documentation
• Once the program has been written and debugged, it is ready for
use and hence requires documentation or a written procedure of
how to run the program, enter data, what problems to expect,
how to handle them, etc.
• Documentation of a program will consist of flowcharts/pseudo
codes, program listings and detailed written statements of
algorithms and procedures involved.
• Documentation is necessary for program maintenance. Without
proper documentation, it will be difficult to change a program at
a later date.
• It is a mis-held notion that documentation is the last step in the
program development stage. In fact, it should be interwoven
with the entire phase of the programming process, especially
with the design and implementation, because documentation is
supposed to enable individuals to understand the logic of
programs.

You might also like