0% found this document useful (0 votes)
84 views6 pages

Program Analysis in Computer Science

The document outlines the process of program analysis, which includes defining the problem, designing a solution, coding, testing, and documentation. It also discusses algorithms, flowcharts, pseudocode, and programming techniques such as structured and modular programming. Each section emphasizes the importance of clear logic and systematic approaches in developing effective computer programs.

Uploaded by

shourya9867
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)
84 views6 pages

Program Analysis in Computer Science

The document outlines the process of program analysis, which includes defining the problem, designing a solution, coding, testing, and documentation. It also discusses algorithms, flowcharts, pseudocode, and programming techniques such as structured and modular programming. Each section emphasizes the importance of clear logic and systematic approaches in developing effective computer programs.

Uploaded by

shourya9867
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

COMPUTER SCIENCE – 1

CHAPTER 2: PROGRAM ANALYSIS


What is Program?
A program is a set of instructions to control the operation of a computer or other
machine. Computer programs are written to solve problems posed by human
kind.
Program Analysis
• Program analysis is a programming process.
• It is a development of program for a specific problem.
• Program development is not so simple.
• It requires number of steps.
• It is a skill and it requires logic.

Steps in programming process


1. Analysing the problem
2. Designing the solution
3. Coding the solution
4. Testing the solution
5. Documenting the solution
1. Analysing the problem
• One should have complete definition of problem and requirement of the
program should be clear before writing the program.
• Generally every program needs input, output, storage and process.
• In general, any problem given has to be analyzed.
• That problem is divided into simple steps leading to solution.
2. Designing the solution
• Program is divided into small modules and then every module is designed
separately.
• Various design methods are available, user can choose any one of them
• Structured programming
• Object oriented programming
3. Coding the solution
• It is the process of translating your program design into computer
programming language.
4. Testing the solution
• After coding programmer has to test the program to see whether it is
executing correctly or not.
• If it is having any errors then user has to correct it.
5. Documentation
• There are two types of documentation:
o Programmer’s documentation
o User’s documentation
• Programmer’s documentation:
o Includes all information related to program codes, designing
methods, testing method, copy of source code program, reports etc.
• User’s documentation:
o In this type, information related to program input parameters and
output parameters are maintained.
o E.g. User manual

Algorithm:
Algorithm is a logical sequence of steps prepared for solving problems. It is a
tool to write the job in simple steps in simple English language. It is not
programming language or program. It guides the programmer to prepare the
program.
Example1: Algorithm to exchange (swap) the value of two variables.
Suppose if A and B are the two variables
1. Store the value of A in T (temporary variable)
T=A
2. Transfer B value to A
A=B
3. Transfer X to B
B=T

Characteristics of algorithm:
1. It should be easy and simple in language.
2. It should not repeat the task again and again
3. Every step must be accurate and complete.
4. It can be easily modified if necessary.
5. It should be easily understandable to others and steps should be clear
6. It should be economical in the use of computer time, computer storage.
Flowcharts
After preparing an algorithm for given task it can be presented in a pictorial
form in brief. The method used to represent an algorithm in pictorial form with
standard meaningful symbols is known as a flowchart. Flowchart is basically
prepared by formulating and understanding algorithms.
With flowcharts programmer illustrates different loops, logical decisions, input
and output data. Flowchart explains actual flow or steps in which program
executes.
To draw flowcharts the following figures are used as standard convention.
1. Rectangular with rounder corners to specify START and STOP. It is usually
used at start and end of program.

STOP START

2. A parallelogram to represent input and output operation. It is known as


input/output symbol. It indicates input process such as keyboard entry and
output process such as printing.

PRINT READ INPUT

3. A rectangle is used to represent processing or calculating part.

S=a+b+c

4. A diamond symbol is used to present decision-making step in the form of


question and logical answer, it is known as “Decision box”.

is
Y=0
?

5. Arrows are used to indicate the direction of flow of program process.


6. A small circle is used to connect incomplete flowchart to its remaining part.
It is known as connector. Normally it is used at the end of page where flow
chart breaks and situation where flow lines cross each other.
A

Following rules must be considered while drawing a flowchart:


1. The standard symbol should be used.
2. The arrows should be used to represent the direction of flow.
3. Flow lines should not cross each other.
4. Program flow should be top to bottom.
Advantage of Flowchart:
 Better programming steps
 Minimum length
 Systematic analysis
 Minimization of errors
 Effective testing and results
 Easy coding
 Universal logical solution

Pseudocode
It is a programming analysis tool used for planning program logic. Pseudo
means false and code refers to the instruction written in programming language.
It is an imitation of actual computer instructions. Pseudo instructions are
phrases written in ordinary natural language. (e.g English, French, German)
Advantages of pseudocode
1. Converting a pseudocode to programming language is much more easier as
compared to flowchart.
2. It’s easy to write pseudocode as compared to drawing flowchart and actual
program because pseudocode has few rules to follow. So it will concentrate
on logic of program.
Limitations of pseudocode
1. Graphic representation of program logic is not available in pseudocode.
2. As there are no standard rules for writing pseudocode, different
programmers may use their own style, which may cause communication
problem.

Programming Techniques
Before programming, user has to decide the method in which program is to be
developed. There are two basic techniques.
1. Structured programming
2. Modular programming

1. Structured Programming
In this programming method, the program is developed in hierarchy of modules
where module refers to subprogram in the main program. It is a top to bottom
approach. In this technique three basic structures are normally adopted such as:
1. A simple sequence
2. A selection by decision
3. A repetition
2. Modular Programming
Modular programming reduces rewriting the subprograms. Each
subprogram may be called as “Functions “ or “Procedures”. Each function
performs a specific routine, which may be required many times in the main
program. All these subprograms are controlled by a single program. Each
module may be called a subroutine.

Common questions

Powered by AI

Flowcharts enhance the efficiency and accuracy of program execution by providing a visual representation of algorithms using standard symbols. They illustrate different loops, logical decisions, input, and output data, making it easier to understand the actual flow and steps of program execution. This visualization helps in better planning and minimizes errors, promotes systematic analysis, and facilitates effective testing and results, which can sometimes be more challenging with just text-based algorithms or pseudocode .

Modular programming minimizes redundancy by allowing the creation of subprograms, or modules, which can be reused across different programs or within the same program at multiple points. Each module performs a specific task, reducing the need to rewrite code. In contrast, structured programming organizes the program into a hierarchy of modules from a top-down approach but may not inherently emphasize code reusability. Modular programming also supports better maintenance and flexibility as each module can be independently modified without affecting the rest of the program .

Analyzing a problem before coding is critical as it leads to a deep understanding of the problem's requirements and constraints. This understanding allows developers to precisely define what inputs, processing, and outputs are needed. By dividing the problem into simpler, manageable steps, it ensures that the proposed solution is feasible and reduces the likelihood of costly errors later in the development process. Effective analysis allows for a more structured approach to designing and coding, which in turn increases the overall success and accuracy of the programming project .

The essential steps in the program development process are: 1) Analyzing the problem, 2) Designing the solution, 3) Coding the solution, 4) Testing the solution, and 5) Documenting the solution. Following these steps in sequence is crucial because it ensures a systematic approach to problem-solving. During analysis, the problem is clearly defined, leading to an effective solution design. Proper coding converts these designs into executable programs. Testing is vital to identify and correct errors, ensuring the program works as intended. Documentation provides essential information for program maintenance and user guidance .

Pseudocode improves focus on programming logic by bypassing the stringent syntax rules required in actual programming languages. Because it employs natural language phrases, pseudocode allows developers to concentrate more on the logical sequence and structure of the program rather than getting bogged down by syntactical correctness. This approach reduces cognitive load associated with syntax errors, helping programmers to develop and refine the logical flow of a program iteratively, ensuring that the logic remains sound before translation into a coding language .

When choosing between structured and modular programming techniques, several considerations should be taken into account: project size and complexity, code reusability, and maintainability needs. Structured programming is suitable for relatively straightforward projects that benefit from clarity and simplicity in control flow. Modular programming, however, is ideal for complex projects requiring frequent reuse of logic components because it organizes code into reusable functions or procedures, enhancing maintainability and scalability. Team structure and future adaptability may also influence the choice, with modular programming often offering greater flexibility in collaborative and evolving project environments .

The characteristics of algorithms facilitate efficient problem-solving by ensuring clarity, precision, and conciseness. Algorithms should be simple and understandable, avoiding unnecessary repetitions. Each step must be clear and complete, enabling accurate translation into programming code. Moreover, algorithms should be easily modifiable, allowing adaptation as requirements change. Their design also considers economical use of computer resources. These traits lead to better-optimized programs and reduce complexity, which aids in effective and efficient problem-solving .

'Connector' symbols in flowcharts represent a small circle used to connect an incomplete flowchart to its remaining part, typically at a page's end or where flow lines cross. They help to organize and separate complex processes into smaller parts. By using connectors, flowcharts avoid clutter, making the program logic clearer and more manageable. This clarity aids in maintaining the flowchart's comprehensibility and effectiveness in illustrating sequential processes without confusion .

Structured programming employs a hierarchy of modules where each module represents a subordinate process. It utilizes a top-down approach to break down tasks, emphasizing logical flow using sequences, selections, and repetitions. In contrast, modular programming focuses on dividing the program into distinct functions or procedures, each performing a specific routine. These modules are more independent and reusable, promoting code reusability and scalability. The core distinction is that while both approaches aim to simplify and standardize program structure, modular programming emphasizes reusability and maintenance, separating concerns more decisively .

Pseudocode has the advantage of being easier to write as it uses ordinary language rather than requiring knowledge of specific symbols, unlike flowcharts. This simplicity allows programmers to focus more on logic. Additionally, translating pseudocode into programming language is generally simpler. However, pseudocode lacks the graphic representation of flowcharts, which can make understanding the flow of logic more challenging for visual learners. Moreover, the absence of standard pseudocode rules can lead to communication issues, as different programmers might adopt different styles .

You might also like