Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

What is structured Programming

The principles of structured programming include a technique that takes a top-down design
approach with block-oriented structures. A programmer will break a program’s source code into
logically structured chunks. The main features, dating back to 1966, include sequencing,
selection, and iteration.

Programming involves the creation of a series of lines, called code, which a computer executes.
The lines comprise a program. Before structured programs came to the forefront, programmers
were frequently guilty of writing "spaghetti code" programs. This was due to using the "Go To"
statement in programs. With the "Go To" statement, the program code would be redirected to
other areas of the program. Both the Basic and Fortran programming languages had no internal
structure or limitations; free form was the rule.

Disadvantages of Structured Programming


Structured programming is a programming technique in which the programmer divides the
source code into logical chunks of code. Typically it follows a top-down design approach with
block-oriented structures. But the disadvantages of structured programming come from the way
programs are written.

Encapsulation

Encapsulation involves the grouping of related concepts into one unit. This allows it to be
referred to by a single name. Encapsulation is writing code so that instead of repetition in
different parts of the program the source code is factored out, replaced in a single piece as a
function. As such, the function acts on the simplest level of encapsulation and abstraction. In this
way, a programmer can refer to the function by name as a single entity. The programmer can
even forget the details of the internals and only remember its interface.

The next level of encapsulation is the Object Oriented world, which expands on this concept
from the subroutine level to the object level. The attributes that represent the state of an object
and the methods that work on them are packaged into an object type.

Encapsulation is one of the main features of Object Oriented Programming, an alternative model
to programming style.

Problem: Lack of Encapsulation

But while the encapsulation concept is a powerful working tool, its lack of availability in
structured programming means that programs will be longer. The same or similar code will
appear in more than one location. This also means that the programs will have a greater chance
of errors. The testing will be lengthy as well since every piece of code will have to be tested.
Even if the code is without errors in one place, the same piece of code may appear in a different
part of the program and could have problems there.
Problem : Same Code Repetition

Because the code that is written may appear in different parts of the program, it can be
vulnerable to different problems because of its location. Programs have variables, which means
that they can take on different values at different parts of the program. So the testing that is
necessary to develop an error-free program can be time consuming.

Lack of Information Hiding

Information hiding involves isolating design decisions in a computer program that have the
greatest chance to change. This protects other parts of the program from modifications if the
design decision is changed. The protection involves providing a stable interface (a point of
interaction between components, either hardware or software) which protects the rest of the
program from the details that are most likely to change.

However, structured programming has no such control. The possibility of spillover from the
effects of coding to other areas is easily possible. For example, once code is executed in one part
of the program, variables that have a value may clash with the same variable in another part of
the program. The possibility that the appearance of the first variable will dominate the second
appearance may cause serious errors. Worse, the debugging efforts might be stymied since the
code will look correct. You cannot hide the results from one part of the program as they may
influence another part.

Summary

The disadvantages of structured programming are lack of encapsulation, lack of information


hiding, repetition, and having a longer program than is necessary. Error control may be harder to
manage; debugging efforts can be stymied because the problem code will look right and even
perform correctly in one part of the program but not in another.

Object Oriented Programming such as C++ and Java are used to avoid many of the problems
associated with structured programming

1. Structured Pro

2. UML

3. Views : Static,Dynamic and Fuctional

4. Object
5. class

You might also like