Programming: Programming Language and Hierarchical Program Organisation Essay

Submitted By tblady6
Words: 1877
Pages: 8

4. PROGRAMMING APPROACHES
Organizations and individuals are continually searching for more efficient ways to perform the software development process. One-way of reducing the time and cost of development is to standardize software programs and the programming process. The benefits of standardized programs are that they are easier to code, maintain, debug, and modify. In recent years, a variety of techniques have appeared attempting to minimize differences in the way programmers' design and develop software. A few of the most commonly used techniques for standardization are described in this lesson. Programming Approaches: Nonstructured Vs. Structured Approaches Structured programming is a standardization technique used for software development. This approach works by having all programmers use the same structured design techniques. Structured programming was invented to address the shortcomings of nonstructured programming, which frequently employed GO TO branch points to transfer from one part of the program to another part. Using GO TO codes, one could transfer backward, forward, or anywhere else within the program. The problem is that the connections between parts of the program by using GO TO commands can become quite haphazard. The haphazard and sometimes convoluted pattern of linkages between parts of the program has been called spaghetti code. This type of programming is difficult to understand and debug. Non-structured programming of this nature is now viewed as an ineffective programming strategy. To develop good software, developers have to carefully think out and design the programs. In the earliest days of computing, programmers wrote software according to their own whims, with the result that programs were often confusing and difficult to work with. Software today is expected to follow recognised design principles. The prevailing design standards are structured programming and structured design. 4.1 STRUCTURED PROGRAMMING Structured programming makes use of the control structures (sequence, selection and repetition). Structured programming does not use GO TO commands. The sequence principle implies that program instructions should be executed in the order in which they appear. The selection principle implies that instructions may be executed selectively using IF-THEN and/or IF-THEN-ELSE statements. These statements work in the following way. IF a condition is met or is true, THEN a specific set of instructions will be executed. If the condition is false, then another set of instructions will be executed. MT 512: Programming Design Page no: 38

For example, IF an employee works 40+ hours a week, THEN calculate gross pay based on an overtime rate of time and a half. If the employee does not work 40+ hours a week, THEN calculate gross pay based on the normal hourly pay rate. IF-THEN-ELSE works in a similar way, but in this case the word ELSE is substituted for a false case, a condition that is not met. IF the employee works 40+ hours a week, then calculate gross pay base on a time and a half pay rate, ELSE calculate gross pay based on the normal rate. Alternatively when there are many options, one can employ the CASE statement. The iteration principle indicates that one part of the program can be repeated or iterated a limited number of times. In most computer languages, the iteration may be activated by using REPEAT ---UNTIL or using the WHILE loop and the FOR loop. 4.2 STRUCTURED DESIGN

According to structured design principles, a program should be designed from the topdown or bottom-up as a hierarchical series of modules. A module is a logical way of partitioning or subdividing a program so that each module performs one or a small number of related tasks. 4.2.1 Modular Programming

The Modular Approach to programming involves breaking a program down into subcomponents called modules. Each module is composed of an independent or selfcontained set of instructions. Modules are also referred to as routines,…