The Computer Revolution/Programming/Designing the Program

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Program Design & Program Logic[edit | edit source]

As you sit down at your computer, whether at home or at work, did you ever consider what it took -- planning, researching, developing, debugging, implementing, updating, etc. -- to get this machine to do what you are doing?

Systems development, in simplest terms, is a six-stage process or life cycle (SDLC) that consists of phases, which often overlap and typically may include:

  1. conducting a preliminary investigation;
  2. then analyzing the system;
  3. designing and
  4. developing the system before
  5. implementation, and finally
  6. providing systems maintenance, including updating and upgrading, with the possibility of beginning the process all over again (Williams, B.K. & S.C. Sawyer. 2007. Using Information Technology: A Practical Introduction to Computers & Communications. 7th ed. Montreal: McGraw-Hill Irwin, pp. 498-505).

The following discussion will focus on the fourth or development phase of this system development process – that is, programming. This particular process involves creating, as the term implies, a “program” or list of instructions that enables the computer to process data into more meaningful information.

While most of us intuitively view programming as simply the writing of program code, there is a great deal more to the process. Reeves is quick to point out that “programming is not about building software; programming is about designing software” and furthermore, “designing software is an exercise in managing complexity” (http://www.bleading-edge.com/Publications/C++Journal/Cpjour2.htm Retrieved Dec 4, 2006). In fact and in review, the following five steps are involved in the programming process:

  1. problem clarification or defining the problem;
  2. program design or designing a solution,
  3. writing or coding the program;
  4. program testing with alpha and beta testing; and
  5. program documentation and maintenance (Williams & Sawyer, pp. 505-516).

Once there has been a decision to proceed with systems development, programming must be undertaken – whether by an external or internal source of programmers. Further, once programming needs have been clarified, the next stage involves designing a “solution specified by the systems analysts” (Williams & Sawyer, p. 507).

First in finding a solution is to create an “algorithm” or set of steps or rules that are unambiguous, as well as simple and as minimalist as possible in achieving that solution. No doubt a “software design must be complete and correct in all its aspects … [but it is also crucial to understand] there are important aspects of software design that do not fall cleanly into the categories of data structures and algorithms,” so it is necessary to use whatever “tools and notations” that help and to recognize that “all design activities interact.” Therefore, the “probability of the initial design being unchanged during this [design] cycle …” is (or should be deemed) impossible. It is essentially a “…controlled process of refinement…” requiring “… good design at all levels” (http://www.bleading-edge.com/Publications/C++Journal/Cpjour2.htm Retrieved Dec 4, 2006).

So, in order to design a program, there are essentially two steps that involve determining:

  1. the program logic and
  2. then its detail.

In today’s world of programming and in the first step (i.e., determining the program logic), a structure or hierarchy chart is utilized to determine program logic. As the term, ”hierarchy,” suggests, it is a top-down design or approach and within the hierarchy are modules or processing steps in the program which attempt to identify all elements and relationships among the elements or modules that maybe required to achieve the program’s purpose. This latter “modularization” concept breaks each operation into smaller, more manageable and often less complex, single functions that enables separation of development and testing activities (Williams & Sawyer, pp. 507-508). Williams & Sawyer have provided a list of considerations or rules that should be kept in mind in determining the modularization, such as keeping each module to a manageable size; each with a single function independent of the others; making sure input and output functions are “clearly defined in separate modules;” with single entry and exit points; and making sure control is returned to “… the point from which is was ‘called’ by …” a first module (p. 509).

In summary, in determining program logic in the program design step, this “structured programming takes a top-down approach that breaks programs into modular forms.” “Standard logic tools called control structures” are also used and will be examined in greater detail in the following section which looks at how design details are determined (Williams & Sawyer, p. 508).

Design Details: Flowcharts, Page Layouts, and Storyboards[edit | edit source]

When designing a Web site, a flowchart is used to describe how the pages in the site relate to one another. The flowchart is basically a map of the structure of the Web site. It uses a single box to signify each Web page and the lines between boxes show the consistent organization of the site.

Three Control Structures[edit | edit source]

The control structures are divided in three groups:

  1. sequence control structure
  2. selection control structure
  3. iteration control structure

The sequential control structure is the most important structure. Its purpose is to execute actions in sequence ( one after another). In all structures of control can be utilized logic operations like (or, and, not) or relations ( =, <, >, <=.=>,< >)

The selection control structure allows the algorithm make decisions or select. The process is executed or omitted according to the fulfillment of the condition or several conditions. A condition is an expression that gives back a true or false value so that the algorithm makes the decision.

Structure-“If”: It is specified by a condition or also known as logical expression, which can be true or false. The algorithm always takes one from both ways.

Structure-“Case”: It is used for the resolution of situations which the number of alternatives is greater than two. According to the value of the expression, can be take different X values, and only one can be executed.

In the iteration control structure is necessary to execute several times and instruction or and instruction set in order to solve some problems. In some cases the number of repetitions is known, but in others the repetition depends on calculation of variables that occur within the resolution of the problem.

Do Until
In this structure is fulfilled the condition and is evaluated after each execution.Therefore, the condition is executed at least once and it is repeated as long as the condition remains false. There is known interactions but always they are greater than 0.
Do while
This structure is opposite to Do until structure. The actions are repeated while the condition remains true. If the condition is false, the execution cannot be generate or the execution of the action stop the production.

Further reading[edit | edit source]