4 Programming and Data Structures
There are various drawbacks of the top-down approach. Here in the design strategy importance
is given to functions rather than data. For example, in turbo C, we cannot give data after c lr s c r ().
If data is declared after c lr s c r (), error will be shown by the compiler.
2) Bottom-up design method: Here the design of a problem starts from the bottom and it goes up
to the top. Some designers prefer this approach. They attempt to find the last blocks of design and
implement them first. By building various blocks from the bottom they ascend towards the top,
assemble all parts designed as planned, and make the final product. Most of the professional designers
do not prefer this approach because it makes the design complex and difficult to implement.
1.3 STEPWISE REFINEMENT AND MODULARITY
A lengthy program can be divided into small programs. This step enables one to follow the programs
easily. It makes it easy to solve a program and bugs in it can be traced easily. The computer itself
cannot do anything. It follows only the instructions given by the programmer. Even if the sub
programs are difficult to understand after dividing the main, sub-programs may be further sub
divided into smaller programs. This process can be continued until the programs are practical.
In any organization, the top management cannot look after every activity of the organization.
They must concentrate on some specific aims or undertaking of the company and delegate
responsibilities to subordinates. In addition, middle level managers also share their responsibilities
with their subordinates. At every level, the work is divided and shared with the subordinates. The
same concept is to be applied to computer programming.
Even if a project seems to be small and one is capable of handling it alone, it is better to do the
same among a group of programmers. This step helps in designing the project quickly and quality
can be assured. However, it is a good approach to divide the problem into sub-programs and solve
each sub-program in a systematic manner.
The above procedure is called top-down refinement. Large programs can be easily solved by this
method. This approach involves deferrment of detailed considerations at the first stage. Even at this
stage attention must be paid to accuracy and inflexibility. The programmer decides the exact way of
division of work between functions. Thus, before working it is essential to know what a particular
function does. Normally it is somewhat difficult to divide the tasks into separate functions. Lot of
thinking has to go at the initial stage. Moreover, some revision is always expected in the function
and scope must be there for improvement. Therefore, a function can be altered in future. To overcome
this confusing situation there are a few guidelines for dividing the program among functions. These
guidelines are as follows:
1) The programmer should explain the use of a function in a few words. If the programmer
fails to do so and writes a lengthy unwanted description, it means that more than enough
details are provided. The detailed descriptions are not to be disclosed and it should not
come into view until the next stage of refinement comes. The programmer must rethink
about the dividing of program. Thus, in short, we can say that each function should perform
only one task with full accuracy.
2) We know that a big organization has hierarchical levels of operations. At the top, there are
several ranks of managers controlling the operations. The middle level managers obtain
information from the lower level. However, the entire information is not passed as it is to
upper level managers. Only the relevant information needed for that manager is sent. In
the same fashion, whatever instruction or information one gets from higher level managers
is not passed as it is to junior level managers or subordinates but only applicable information
is passed on to them. The function we are going to design should follow the above principle.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.133.180