100% found this document useful (1 vote)
273 views

LESSON 2 3-Algorithims-Pseudocodes-Flowcharts

The document discusses several program design tools: 1) Algorithms are step-by-step instructions to solve a problem in a finite number of steps. 2) Pseudocode is a simpler version of code using plain English that can be translated into an actual program. 3) Flowcharts use standard symbols to show the flow and logic of a program. The document also compares algorithms, pseudocode, and programs, and discusses top-down and modular programming approaches.

Uploaded by

Dun kitheka
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
100% found this document useful (1 vote)
273 views

LESSON 2 3-Algorithims-Pseudocodes-Flowcharts

The document discusses several program design tools: 1) Algorithms are step-by-step instructions to solve a problem in a finite number of steps. 2) Pseudocode is a simpler version of code using plain English that can be translated into an actual program. 3) Flowcharts use standard symbols to show the flow and logic of a program. The document also compares algorithms, pseudocode, and programs, and discusses top-down and modular programming approaches.

Uploaded by

Dun kitheka
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
You are on page 1/ 10

LESSON 2: PROGRAM DESIGN TOOLS

1. Algorithm:

An algorithm is a sequence of instructions or step by step instruction to find the solution


of a problem. An algorithm should be simple and clear. It must be to the point and
should lead to the solution of the problem in a finite number of steps.

In other words, the set of rules that define how a particular problem can be solved in a
finite number of steps is known as an algorithm. An algorithm is composed of a finite
set of steps, each of which may require one or more operations. Each operation must be
definite, effective and finite

A program is the expression of an algorithm in a programming language. Thus, the


success of a program depends on upon the algorithm. Therefore, the logic of the
problem must be clearly expressed in an algorithm. In another way, we can say that an
algorithm is a collection of a finite number of instructions arranged in a sequence to
find the solution of a problem.

Example 1: Algorithm for adding the two numbers.

Step1: Start the program


Step2: Input number x,y
Step3: Read x, y
Step4: Z←x+y
Step5: Print Z
Step6: Stop the program

Example 2: An algorithm to go to the cinema and see a movie.

Step1: Start the program


Step2: Go to the cinema hall
Step3: Is the ticket counter open?
Step4: If it is not open, return home
Step5: If it is open, buy a ticket
Step6: Get into the cinema hall
Step7: Watch the movie
Step8: Return home
Step9: End the program

Page 1 of 10
2. Structured English (Pseudo code)

The general meaning of Pseudo code is false code or fake code. Before we write a real
program, we write a program that looks like a code on the basis of algorithm and
flowchart, which may not be syntactically correct but looks like a program code is
called Pseudo code. The instruction of pseudo code is written by using English phrase
and mathematical expression. It has no hard or fast rules for writing instruction but the
instruction is closer to high-level language instructions. Therefore, the pseudo code
designers should have basic knowledge about high-level language before writing it. It is
independent of any programming language.

Example: Pseudo code for calculating area of rectangle

Input length, breadth


Calculate area= length*breadth
Output area

3. Flowchart:

A flowchart is a pictorial representation of an algorithm. We can also define it as a


program planning tool for organizing a sequence of steps necessary to solve a problem,
which is shown in terms of symbols.

Flowchart uses symbols that have geometrical shapes to indicate the different operations.
These symbols are connected by flow lines which indicate the order of execution of the
various activities. It is used by the programmers to develop programs and by system,
designers to represent the overall system while analyzing and developing the system.

The advantages of flowchart are:

1) It is an independent language. So, the flowchart we design for programming in


one language is applicable for programming in another language.

Page 2 of 10
2) Once the flowchart is prepared, it is very easy to do the coding by looking at the
algorithm.
3) It is very easy to understand the logic of program by designing the flowchart.
Even people who don’t know the coding can understand the logic of a program
with the help of flowchart.
4) Systematic debugging and testing is easily possible with the help of flowchart.
5) It provides good documentation for an organization.
6) It is useful in debugging the program.
7) It provides valuable information which cannot be expressed by thousands of words.
8) It is user-friendly and can be more easily understood.
9) It expresses the clear logic of a given procedure.
10) It is unambiguous as there can be only one direction of logic at any one time.
11) It is used as working models in the design of new programs and systems.

The disadvantages of flowchart are:

1) Preparing a flowchart is a time-consuming process.


2) If there is a change in logic again, we have to develop the new flowchart.
3) Flowchart does not provide any convenient means to highlight the most important
operation.
4) The flowchart is quite costly to produce and difficult to use and manage.
5) Complex and detailed charts can be laborious to plan and draw.
6) The translation of flowchart into computer programs is not easy.
7) Preparation of flowchart is a very slow process.
8) Most software developers believe that flowcharts are a waste of time and that
these slow down the process of software development. So, they do not start the
software development with flowcharts. Flowcharts are only used for the purpose
of documentation.

Page 3 of 10
Symbols for flowcharts

Figure: Basic symbol for flowchart

Types of Flowchart

1) System flowchart

A flowchart that gives information about a system is called system flowchart. The
system can be data processing system, production system, reservation system, inventory
system, accounting system and evaluation system. It plays a very important role in
analysis and designing of the new system.

In system flowchart, the information flows from one section of the organizational unit
to another section or forms one processing machine to another. It is drawn by the
system designer while developing the new system. It does not focus on the process to
solve a particular problem. An information processing cycle can be illustrated below:

Page 4 of 10
In other words, a system flowchart describes the data flow and operations for a data
processing system. It shows how the data processing is to be accomplished.

2) Program flowchart:

Program flowchart describes the sequence of operations and decisions for a particular
program. In other words, we can say that a diagrammatical or pictorial sequence of
instructions used by a programmer to solve any problem is called Program Flowchart.

Program flowchart is a flowchart which is used by the programmer to solve a problem. It


is the detailed program which is shown in the form of pictures that how program
processing steps will be performed within the computer to convert input data into the
desired output.

Differences between System flowchart and Program flowchart:

System flowchart Program flowchart


It is designed by system designers. It is designed by programmers.
It shows a system’s flow of data. It shows a program’s flow of instructions.
It gives a broad overview of the overall It gives a specific view of a control flow of a
system. program.
It is used to design large sized real world It is used to design small sized logical &
problems. mathematical problems.
One must have good knowledge of various
Since there are limited symbols, it is easy to
existing symbols to understand the system
understand for normal people also.
flowchart.
Difference between Algorithm, Pseudocode and Program

Algorithm: Systematic logical approach which is a well-defined, step-by-step


procedure that allows a computer to solve a problem.
Pseudocode: It is a simpler version of a programming code in plain English which
uses short phrases to write code for a program before it is implemented in a specific
programming language.
Program: It is exact code written for problem following all the rules of the
programming language.

SUMMARY

Page 5 of 10
The learners were introduced to program design tools such as; flowcharts, Pseudocode
and algorithms. Flowcharts used standard symbols, algorithms use English statements,
while Pseudocode are written in symbols (false codes). Finally, program solving styles
and strategies were discussed.

Revision Questions

1. Draw a flowchart to compare ages of three students.


2. Translate the above flowchart to an algorithm
3. Translate the above algorithm to a Pseudocode.

WEEK 3: PROBLEM SOLVING STRATEGIES

PROGRAMMING STYLES
Monolithic Approach
A program is developed as a single piece of code. This style is not suitable for
complex programs.
Demerits

 Difficult to modify codes


 Difficult to test and debug.
Modularization
In this style a complex is broken down into simple manageable problems. Solution for
each sub-problem is developed. Finally, the sub-solutions are combined to for the
overall solution. In this style, sub-problems are also known as modules or subroutines.
Merits
Best approach for complex problems.

 A problem can be solved by a team of programmer/analysts. Each solving a certain


module.
 Easy to test and debug
 Short program development time.
 It promotes code reusability

Page 6 of 10
PROGRAMMING APPROACHES
They include
Top-Down Approach
In this approach the management starts by creating a general overview of the problem.
Later, the experts (I.T experts) analyze the overall problem, then break it down into
modules. Finally, the solution for each module are provided.
In this approach, a large project divides into small programs, and these programs are
known as modules.
C programming language supports this approach for developing projects. It is always
good idea that decomposing solution into modules in a hierarchal manner.
The basic task of a top-down approach is to divide the problem into tasks and then
divide tasks into smaller sub-tasks and so on.
In this approach, first we develop the main module and then the next level modules are
developed. This procedure is continued until all the modules are developed.

Advantages of top-down approach:

1. In this approach, first, we develop and test most important module.


2. This approach is easy to see the progress of the project by developer or customer.
3. Using this approach, we can utilize computer resources in a proper manner
according to the project.
4. Testing and debugging is easier and efficient.
5. In this approach, project implementation is smoother and shorter.
6. This approach is good for detecting and correcting time delays.

Page 7 of 10
Example of a Top-Down Approach (Railway Reservation System)

Bottom up Approach
This approach starts by creating the finer details that contribute to the overall picture
of the whole system. Here, at the department/sections, systems are analyzed, and the
problem is well articulated. Further, the modules are designed and developed. Finally,
the integration of the modules is done to come up with a complete system.

C++ used the bottom-up approach for project development. It is an alternative


approach to the top-down approach.
In this approach, bottom level modules developed first (Lower level module
developed, tested and debugged). Then the next module developed, tested and
debugged. This process is continued until all modules have been completed.
This approach is exactly opposite to the top-down approach. This approach is good for
reusability of code.

Page 8 of 10
Example of a Bottom-Up Approach (Railway Reservation System)

Advantages and disadvantages of the top-down and bottom-up implementation


approaches

The top-down and bottom-up approaches to deploying your identity management solution are
provided to help you decide the best way to integrate identity management capabilities into your
environment. Each approach has distinct advantages and disadvantages, as shown in the Table
below.

Pros and cons of the top-down and bottom-up implementation approaches


Bottom-up approach Top-down approach
Summary
 High deployment coverage in early
phases  Tactical, limited coverage
 Earlier return on investment  Delayed return on investment
 High visibility of organizational  Lower impact to overall organization
changes  Higher deployment costs
 Higher impact to organization

Advantages
 User and business awareness of the  Your organization realizes a focused use
product. Benefits are realized in the of resources from the individual
early phases. managed application.
 You can replace many manual  The first implementation becomes a
processes with early automation. showcase for the identity management
 You can implement password solution.
management for a large number of  When the phases are completed for the
users. managed application, you have

Page 9 of 10
Pros and cons of the top-down and bottom-up implementation approaches
Bottom-up approach Top-down approach
 You do not have to develop custom
adapters in the early phases. implemented a deeper, more mature
 Your organization broadens identity implementation of the identity
management skills and understanding management solution.
during the first phase.  Operation and maintenance resources are
 Tivoli Identity Manager is introduced to not initially impacted as severely as with
your business with less intrusion to your the bottom-up approach.
operations.

Disadvantages
 The organizational structure you  The solution provides limited coverage
establish might have to be changed in a in the first phases.
later roll-out phase.  A minimal percentage of user accounts
 Because of the immediate changes to are managed in the first phases.
repository owners and the user  You might have to develop custom
population, the roll-out will have a adapters at an early stage.
higher impact earlier and require greater  The support and overall business will not
cooperation. realize the benefit of the solution as
 This strategy is driven by the existing rapidly.
infrastructure instead of the business  The implementation cost is likely to be
processes. higher.

SUMMARY
In this section, the learner was introduced to program design styles and strategies.
Monolithic and modularization styles were discussed in details. Finally, top down and
bottom up strategies were discussed giving merits, and demerits of each.

Revision Questions

1. Distinguish between monolithic and modularization styles.


2. Write a program to calculate volume of shapes using modularization.

Page 10 of 10

You might also like