You are on page 1of 18

Unit-1st

Syllabus: An overview: Problem identification, analysis, design, coding, testing & debugging,
implementation,
modification & maintenance; algorithms & flowcharts; Characteristics of a good program -
accuracy,
simplicity, robustness, portability, minimum resource & time requirement, modularization; Rules/
conventions of coding, documentation, naming variables; Top down design; Bottom-up design.

Basic Terminology

Computer : computer is an electronic device. It has memory and performs input


and output operations.

Input:-
The data entering into the computer is known as Input.
Output:-
The resultant information obtained by the computer is known as output.

Program:-
A sequence of instructions to solve the given problem is known as
Program.
Software:-
A group of programs to operate and controls the operation of a
computer.
Hardware:-
The physical components which are connecting to the computer
circuit.

Various steps involved in program development:-


The following steps are involved in program development.
1. Problem definition
2. Problem analysis and design
3. Algorithm
4. Flowchart
5. Coding and implementation.
6. Debuging and testing.
7. Documentation.

1.Problem definition:-
Defining the problem is nothing but understanding the problem.It involves
3 specifications regarding problem solution.
i. Input specifications.
ii. output specifications
iii.processing
So, two things are two be discussed:
What is to be done , How much to be done.

2. Problem analysis and design:-


Before going to make a final solution for the problem, the problem must
be analyzed. Outline solution is prepared for the simple problems. But in case
of Complex problems, the main problem is divided into sub problems called
"modules". Each module can be handled and it can be solved independently.
When the task is too large, it is always better to divide into no of modules
and seek solution for each individual module. The main task of analyses phase is
“information gathering” . The detailed information of domain for which we are
developing the software is collected . It may require following activities :
• Interviewing the persons involved
• Question\answer
• Documents reading
• Observation? monitoring etc

Every information is kept in writing. Information is converted in to more formal,
figurative or diagrammatically approach . The tools used are :
ER diagram
Data flow diagram
Condition table
System Flow chart .
The major steps of designing are :
• Form design – GUI for input
• Report design-for output
• Database design – to store the data
Database design requires normalization, key selection decision, functional
dependence etc . Database is the most important part of the user because the
complete data is kept in the database.

3.Algorithm:-
A step by step procedure to solve the given problem is known as
Algorithm.
An algorithm can be described in a natural language such as English.
4.Flow chart:-
A symbolic (or) Graphical representation of given algorithm is
known as Flow chart.

5.Coding and Implementation:-


Coding is a process of converting the algorithms (or) flow chart into a
computer program.In this process each and every step of an algorithm will
be converted into instructions of selected computer programming language.

Before selecting a programming language we must follow the 3 conditions.


1.Nature of a program.
2.Programming language available on the computer system and
3.Limitations of the computer.

6.Debugging and testing:-


Before loading the program into the computer, we must locate and collect
all errors. The process of correcting errors in a program is called debugging.
these are 3 types of errors that generally occur in the program.
1. Syntax errors : If there is violation of any syntax rules, the compiler reports
about the errors. These errors are detected at compilation time. (like -: Semicolon
not placed , Identifier not declared etc.)

2. Run time errors :Runtime errors is produced during execution phase.


(Division by zero, Squre root of negative number, file not found etc)

3. Logical errors : These errors are produced due to wrong logic of program.
The logical are the most dangerous type of errors . The complete testing and
debugging phase of software development is dedicated to remove logical errors . (
Like :- A variable not initialized, Boundary case errors in loops ,
Misunderstanding of priority and associativity of operators etc )
It is very important to test the program written to achieve a specific task.
Testing involves the program with known data of which the results are known.
The results are known, the results produced by the computer can be verified.
7. Modification & maintenance :-
Some uncovered errors are reported by the user . These errors must be removed.
Moreover, there are changes in the user’s working environment. The user
requests the changes in the software according to his changing needs. The
developer modifies the software.
8.Documentation:-
It is the most important aspect of the programming. It is a continuous process
to keep the copy of the phases involved in problem definition,...........
........ , debugging and testing are the parts of the documentation.
This phase involves producing written document for the users.

Rules and Conventions of making identifiers:-


(1) The first character must be an alphabet.
Remaining character may be alpha numeric.
(2) No special character other than underscore is permitted.
(3) Space is not permitted.
(4) The maximum length is compiler define.

Following are two conventions regarding forming identifier.


(1) The identifier name should be such that it should reflect its purpose.
(2) The identifiers should not be too large.
(3) The variable identifier is taken in small case.
(4) Constant identifier is taken in capital case
For example int a, b;
# define PI= 3.14
(5) Confusing names should be avoided.

---------------------------------------x-----------x-----------x-----------
x------------------------------------------------------
Characteristic of good program :
1. Correctness: a program should produce exactly what is desired.

2. Simplicity of logic: The logic of the program should be as simple as


possible. There can be many methods to solve a problem . We should
select the easiest method.

3. Clarity: The program should be made in such a way that it should be easily
understandable to others. For this following point should be kept in mind:
documentation, indentation & naming of variables

4. Documentation/comments :
Unexecutable lines in a program are called comments. Those lines
are skipped by the compiler. The programmer should include comments in his
program. The comments enhance the understandability. Following are the points where
the documentation are essential:
• At the begging of the program about its purpose
• At if condition
• Just before loop
• Just before a set of statements for a specific purpose
• Just before a body of a function telling about its purpose

5. Indentation: Indentation means right shifting of the statements inside the


special construct, like- if and for statement. Indentation clearly indicates
the limit of the body of the construct.

6. Portability or platform independence: A program made on a source


platform should behave in the similar manner on the target platform ,
means program should be portable & platform independent. The source &
target platform may be different configuration

7. Robustness: A robust product can be one that doesn't break easily. Thus,
an operating system in which any individual application can fail without
disturbing the operating system or other applications can be said to be robust. ,
robust can describe one or more of several qualities:

a system that does not break down easily or is not wholly affected by a single
application failure

a system that either recovers quickly from or holds up well under exceptional
circumstances

8.Minimum resource requirement: The program should be such that, it


should consume minimum computing resource like – minimum CPU time,
minimum main memory. So the logic of the program should be simple, the
size of the program should be small, dynamic allocation should me preferred.

------------------------------------x---------x----------x-----------
x------------------------------------------------------------------
Top down & Bottom-up design
These are two design approaches, which can be explained as:You can imagine a tree like
structure , in which when you are following top-down appoarch you move from root node
to leaf node and when you follow bottom-up apprach you follow leaf node to root node.
In structure programming, the unit of the program is function. To develop a
program, We have to write functions of procedures. Each function is a sub program,
which has declared to perform a specific task. This approach is also called procedure
centric. Here data is shifted from one procedure to another procedure for processing. This
approach is called Top-down –approach, in which a problem is divided into subparts and
they may be further divided into subparts.
On the basis of modular programming(moduler programming can be used to
break up a large program into manageable units) the program is designed in top-down
approach. As we go towards bottom, the task become simpler ans easy..... "Top
down" is a design methodology - it has nothing to do with a specific programming
language - it's a general method for designing software (and other systems) starting with a
high level architecture and working downwards to a more detailed implementation level.

.In object oriented approach, unit of problem is object. Each object is collection is
data & methods. Methods are bind with rather than shifting data between methods. This
approach is called data centric approach, where data is kept center in the design and all
methods comes around to this data. Object oriented approach is bottom-up-approach
where we start from bottom like finding objects than establish relationship between them.

--------------------x------------------------x------------------------
x--------------------------x-------------------------------------

What is Flowchart ?
How chart is a graphical representation of a program, using flowchart we can
understand the logic of program. There are some symbols representations which
used for making a flowchart. Through flowchart we can understand the flow of
data in easy manner.
Symbols for making a flowchart

1) Terminal Blocks
2) Input / Output Block:

3) Processing Box

4) Flow Lines

5) Decision Box

6) Connector
7) Annotation Box / Comments Box

This box is used to provide descriptive or explanatory information about the connecting flowchart
symbol.
.
NESTED IF STATEMENT

When a series of decisions are involved. We may have to use more than one if-else
statement in nested form.

if( test condition-1 )

if( test ondition-2)

Statement 1;

else
{

Statement 2;

else

Statement 3;

Statement x;

If the condition-1 is false then the statement 3 is executed, otherwise it continues to


perform the second test.

If the condition 2 is true statement 1 is executed otherwise statement 2 is executed. And


then the control is transferred to the statement x.

False Test True

Condition

False Test
True

Condition

?
Statement 2
Statement 1

Statement 3

Statement x

Next statement

Flowchart of nested if-else statement.

The else – if ladder :

There is another way of putting if together when multipath decisions are involved. A
multipath decision is a chain if in which the statement associated with each else is an if.

Syntax :

if( condition-1 )

statement-1;

else-if ( condition-2)

statement-2;

else-if ( condition-3)

statement-3;

else-if ( condition-n)

statement-n;
else

default-statement;

statement-x;

This construct is known as the else if ladder.

Example: Average marks Grade

80 to 100 Hon ours

60 to 79 1st division

50 to 59 2nd division

40 to 49 3rd division

00 to 39 Fail

if( marks > 79 && marks < 100)

grade = “ Hon ours ” ;

else if ( marks > 59)

grade = “ 1st division ”;

else if ( marks > 49)

grade = “ 2nd division ”;

else if ( marks > 39)

grade = “ 3rd division ”;

else if ( marks > 0)

grade = “ Fail ”;

else

printf(“Invalid Entry”);
Entry

True Condition False

Statement 1 True Condition False

Statement

True False

Condition

Statement Statement

Statement - x
next statement

---------------------x--------------------x----------------x---------------x--------------------x-------------------------

Algorithm

Question : What is algorithm ?

An algorithm may be defined as a sequence of instructions or steps that will give


the solutions to any problem of a given type. Algorithm is a simple step of program
. By algorithm we clear the concept of program using some general steps and
program is a advance part or real part of problem which can we easily
implemented.

For example : Preparation for making tea.

Algorithm for addition of two numbers

Step – 1 Take the data type as a int type.

Step – 2 Take three variable a, b and total.

Step – 3 Enter the numbers.

Step – 4 Addition total = a + b

Step – 5 Print the value total.

Step – 6 Stop.

Note : It is a process of a program. Syntax doesn’t matter. Logic is important in


algorithm.

Sorting algorithm :

Step – 1 Start with main function.

Step – 2 Clear the screen.

Step – 3 Take
Step – 4 Display message and scan the values. These steps

repeats 10 times.

Step – 5 Execute the outer loops for 10 times.

Step – 6 Execute the inner loop.

Step – 7 Compare the value to next value by using if

statement . This process repeat until the condition

gets failed.

Step – 8 Interchange the contents of two variables

according to the condition.

Step – 9 Finally print the sorted elements.

Step – 10 Exit.

Algorithm for swapping

Step – 1 Clear the screen.

Step – 2 Display the message for entering the value of a and b.

Step – 3 Read the value from keyboard.

Step – 4 Call the swap function and pass the two references.

Step – 5 Execute swap function.

Step – 6 ,7 & 8 Interchange the contents of x and y.

Step – 9 & 10 Print the changed value of a & b.

robust
(adj.) When used to describe software or computer systems, robust can describe one or more of several qualities:
• a system that does not break down easily or is not wholly affected by a single application failure
• a system that either recovers quickly from or holds up well under exceptional circumstances
• a system that is not wholly affected by a bug in one aspect of it
• a system that comes with a wide range of capabilities. (It should be noted that this last sense of the term robust is not
uniformly accepted in technical circles. The term is typically used in this sense in the marketing of software or
computer systems to emphasize a selling point and does not refer to the first three meanings of the term.)

A robust product can be one that doesn't break easily. Thus, an operating system in
which any individual application can fail without disturbing the operating system or
other applications can be said to be robust.

It derives from the Latin robustus , meaning "strength."

You might also like