You are on page 1of 10

CSC318: Structured Programming

A. A. Habila (Room-GO6)
Department of Computer Science
Federal University Lafia
Introduction
 We know that a computer program is a collection of instructions/commands that

directs the computer in its computation(calculations and data movements)

 We also know that learning a programming language entails getting to know the

rules, and statements of the language etc.

 While learning the How of programming means learning the skills of developing

solutions to given problems, we don’t know enough of how to organize a program

and getting to make effective use of standard techniques, etc.

 Historically, between 1950s and 1960s, programs were written off the top of the

head, like instructing someone to clean the board, open the door, etc, and should

something goes wrong, you just try to patch it (error by error kind of fixing issues)

instead of developing a general method of organizing a solution (program).


Introduction cont..
 Though this approach was tolerable with first and second generation computers, up until

3rd generation around late 1960s, when hardware became excessivelly more powerful than

could have been anticipated, the usual hit-and-miss approach to programming couldn’t

keep to pace anymore.

 Software were expected to be do more work, they grew longer in lines reaching thounsands,

many more programmers had to work together on projects, it took longer to deliver in most

cases more than earlier projected, cost of development skyrockted including that of

maintenance.

 This unavoidably grew a need for a systematic approach to program organization.

 This chaotic situation was referred to as sofware crisis and the period thereof was tag

software crisis era. A NATO conference was even convened to discuss this particular

global issue or concern.


Historical Developments
 IBM OS/360: this operating system was developed for System 360
 It cost hundreds of millions of dollars

 It was delivered a year later than earlier scheduled

 Thousands of errors were discovered after release

 Much of a programmer’s time is spent debugging


 Syntax errors are easy to detect and be corrected

 Planning and Logical errors in design of the program are so delicate such that
even throughout the entire lifetime of the program, they may not be taken care
of completely. These debugging issues appears inevitable

 It should also be noted that issues or problems with a program may be about
life and death hence the sensitivity associated with software programming and
debugging.
Historical Developments cont..
 Space Shuttle Columbia with astranauts John Young & Robert Cropper
 Both astranauts were inside the rocket and it’s just 20 minutes before lunch
when warning lights flashed at the mission control station.

 Initial investigation showed nothing is wrong with the hardware setup.

 Attention shifted to the possibility of issues with the over 500,000 interwoven
lines of computer program.

 The first Moonshot in 1969: In one of the trajectory computation, Moon’s


gravity repulsion was used instead of its attraction. This was discovered
by chance five days before takeoff

 Finding a programming error is just like finding a mispelled word in an


encyclopedia. ~ Steven Oslon
Historical Developments cont..
 At the 1964 International Colloquim held in Israel: Corrado Bohm and
Jacopin Guisepo proved mathematically that only three control structures
were necessary to write any program. This rendered the GoTo statement
unnecessary.

 Much of these developments were ignored in places like USA until 1968.
Edsger Dijkstra published a letter titled: Goto statement considered harmful
in ACM in 1966. Dijkstra continued crusade for structured programming for
over 20 years.

 In the mid-1970s, Edward Yourdon conducted several seminars on the


subject but its widespreed acceptance particularly in the USA was until 1972
after the sucessful completion of the famous New York Times Project which
was highly guided by the structured programming principles.
Historical Developments cont..
The New York Times Project: developed by an IBM team headed by Harlan Mills

A system that automate the newspaper’s file clipping using a list of of index terms, users browse through

abstracts of all the papers articles and then retrieve the full publication from microfiche and thereafter

displayed on a terminal.

This project was very successful.

 It lasted only 22 months

 Contained 83,000 lines of code

 Acceptance testing was carriedout for a week

 The system was used for over 20 months before first error was detected

 The project was delivered under budget and release ahead of schedule.

 At this point, software developers began paying attention to the gospel of the principles of structured

programming especially by Dijkstra

 [Mid-Late 1970s], this development was considered a revolution in programming and one of the most

important advances in computer software of the 1960s & 1970s

 We are specifically interested in philosophies and techniques leading to structured programming.


Definition of Structured Programming
 Some will say this is programming without the use of GoTo statement. Yes, a structured

program would certainly not have GoTo statements in it, but the entirety of the concept is

beyond just doing away with GoTo. It is sure way more than that.

 First, we have to understand the extent of the problem addressed by structured

programming – the problem of complexity.

 It is actually okay to have a very huge software system which will definitely be made up of

several lines. E.g. Word processors, operating systems, DBMS, enterprise applications, etc.

 The issues is, programs of few hundred lines often get unwieldy and difficult to keep track of

its details. With large software systems, it is rather impossible.

 A method of designing computer system components and their relationships such that

complexity is minimized. The trouble here is ”method” is not specified in this definition.
Definition of Structured Programming cont..
How does structured programming minimizes program complexity?
i. Top-down analysis for problem solving:
o What is the program doing for you? – the problem it is addressing

o Can you solve the problem yourself in your own way?

o Subdivide a large problem into smaller task such that can be address with ease

ii. Modularisation for program structure and organisation


o Address the pieces of task independently in modules, subroutines, subprograms, etc.

o Each problem task corresponds to a module

iii. Structured code for individual modules:


o Organizing instructions in groups that could be executed in a definable fashion.

o This is possible with the use of various control structures namely: sequential, selective, iterative – A
control stucture represents a unique pattern of execution for a specific set of instruction and guides or
detect the order of its execution.

o If the order in which instructions in a module are executed can be exclusively determined by the aid of
control structures, then the module is said to be structured and the code is described as structured code.
Definition of Structured Programming cont..
Structured programming is therefore about three elements namely:
top-down analysis, modular programming, and structured coding.
Advantages of Structured Programming:
o It is easier and faster to write programs

o Improved program reliability: fewer organisational and logical error

o Reduced debugging and testing times

o Ease of maintenance

Overall, improved programmer productivity.

The Goal of Structured Programming : emphasis on maximising progreammer productivity and software
systems reliability.

Relationship between Structured Programming and Programming Languages:


o Structured programming principles can be applied to any programming language

o Some languages have been designed with structured programming principles in mind such that it is
impossible to write unstructured code.

o The ease of writing structure code is largely dependent on the language support.

You might also like