Programming as an Art Form
When programming emerged as an activity some forty years
ago, the main preoccupation was with the correctness of the solution. Precisely
how that solution was derived was very much subordinate to the actual solution
itself.
The design tool that emerged from this period was the
flowchart. Flowcharts are a diagrammatic representation of the flow of logic
within a program or within an individual process. To some extent, they provided
a means of depicting the program structure, but their main concern as with the
logic flow. This reflected the contemporary view that programming was mainly
concerned with logic.
Structured programming
Structured programming was developed during the 1950s after
Edger Dijiksta’s insightful comments into the harmful nature of the GO TO
statement. Dijiksta and others subsequently created a set of acceptable
structures in programming that would enable development without GO TO
statements.
The structured programming uses three control constructs
namely:
·
Sequence
·
Selection
·
Repetition
These structures produced programs that were easier to read
by humans easier to debug and easier to test.
Object Oriented Programming
Object – oriented programming (OOP) is an emerging major programming
paradigm. Much of its approach to program and system design is owed to concepts
which also gave rest to structured programming. An object is a particular
instance of a class and consists, essentially, of data which defines its
characteristics and current status together with procedures, or ‘methods’,
which operate on the object.
For example, an object may be a bank account possessing data
items which record the name and address of its owner and its current balance.
It may have associated methods which allow its creation, deletion and amendment
with deposits and withdrawals.
1.1.1. Tools
for Program Design
Over the years, in search for an optimum means of providing
the precision needed for designing the solution to a problem, a number of
design tools have emerged. The common aim is to remove the expression of the
solution from the ‘plain language’ we might use in describing it to another
person. ‘Plain’ – spoken or written language is often not plain at all. It is
full of imprecision and ambiguities. It often leaves many things unsaid,
relying on the ‘common sense’ of the listener and the reader.
The notation used for algorithm specification must conform
to a basic set of criteria:
It must be concise – we must be able to describe the
solution to a problem without writing multiple pages of text.
It must be unambiguous – the description og the
procedure must not be open to alternative interpretations. We must remember
that the algorithm will be executed by a machine which has no ‘common sense’ or
inbuilt knowledge of the nature of the problem.
It must be capable of machine execution – the actions
described must be capable of translation into precise, machine – executable
operations. This precludes such statements as “choose the best candidate”. If
this were the object of the operation, the steps involved in evaluating the
exact criteria for what constituted “best” must be clearly set out.
It must promote elegance in the solution – the tool
must prevent the programmer from using practices at the design stage which
leads to poor programming style during implementation. The selection of an
appropriate design tool has a great influence on the quality of the ultimate
program. A good design tool will lead to programs which are elegant in their
design, accurate in their operation and easy to amend and enhance over a long
period of time. Conversely, a poor design tool will promote not of these
criteria.
A flowchart is a diagrammatic representation of the
processes involved in arriving at a solution to a problem. While many symbols
are included in its notation, the. Most important are:
Termination
Yes
Terminator
|
Flow Chart – 2
Selection –
Flowchart to input 2 numbers and thereafter evaluate and display the
maximum value.
|
Briefly describe the following structured control
constructs.
Sequence –
Selection –
Iteration –
|
Flow Chart – 1
Sequence –
Flowchart to input two numbers and thereafter calculate and display the
average.
|
No comments:
Post a Comment