Structured Programming Language Programming in C Computer ScienceApplications














- Slides: 14

Structured Programming Language Programming in C Computer Science/Applications Ponukumati Jyothi M. Tech Govt. Degree College, Pathapatnam Email. Id : jyothi. ponukumati@gmail. com

Objective On completion of this Session, you would be able to know §The Structured Programming Language §Design and Implementation of Correct, Efficient and Maintainable Programs.

Structured Programming A technique for organizing and coding computer programs in which a hierarchy of modules is used, each having a single entry and a single exit point, and in which control is passed downward through the structure without unconditional branches to higher levels of the structure. Structured programming is also referred as modular programming. It is a subset of Procedural Oriented Programming and enforces a logical structure on the program to make it efficient and easy to understand modify.

Structured Programming Cont. . Structured programming ◦ Disciplined approach to writing programs ◦ Clear, easy to test and debug and easy to modify §Three types of control flow are used: ◦ Sequence ◦ Test ◦ Iteration

Sequence Control Structure It consists of a single statement or a sequence of statements with a single entry and single exit as shown in Figure Statement 1 Statement 2 Statement 3

Test Control Structure It consists of a condition (simple or compound ) and two branches out of which one is to be followed depending on the condition being true or false as shown below

Iteration Control Structure It consists of a condition (simple or compound ) and sequence structure which is executed condition based as shown below

Structured Programming Cont. . The following language usage is forbidden: § "Go. To" statements § "break" or "continue" out of the middle of loops § Multiple exit points to a function/procedure/subroutine (i. e. , multiple "return" statements). § Multiple entry points to a function/procedure/subroutine.

Advantages of Structured Programming §Complexity can be reduced §Logical structures ensure clear flow of control §Increase in productivity §Modules can be reused many times §Easy to update fix the program by replacing individual module §Ability to either eliminate or at least reduce the necessity of employing GOTO statement.

Disadvantages of Structured Programming §Since go to statement is not used, the structure of the program needs to be planned meticulously. §Lack of encapsulation. §Same code repetition. §Lack of information hiding. §Change of even a single data structure in a program necessitates changes at many places throughout it. §Not much reusability of code. §Can support the software development projects easily up to a certain level of complexity.

Design and implementation of correct efficient and maintainable programs Program Development Life Cycle: 1. 2. 3. 4. 5. 6. Problem definition Problem analysis Algorithm development Coding and documentation Testing and debugging Maintenance.

The quality of software program depends on the following factors: Correctness: The extent to which a program satisfies its specification and fulfills the customer’s needs Efficiency: The amount of code and computing resources required by a program to perform its function. Maintainability: The effort that is required to locate and fix an error in a program.

Summary In this Session, you have learned… §About Structured Programming Language §Design and Implementation of Correct, Efficient and Maintainable Programs.

Ponukumati Jyothi Lecturer in Computer Applications