THE AUTOMATED FLOWCHART DESIGN AND CODE WRITING SYSTEM

Home || Contact us || Create code logic ||

LogicCoder Online Tutorial 2 of 7-FLOWCHART PRINCIPLES
> About LogicCoder
> What LogicCoder does?
> Sample screen-shots
> Online tutorial
>> Program flowcharts
>> Understanding the rules
>> Example program solution
>> Introduction to LogicCoder
>> Building a flowchart
>> Editing and coding
>> Abstracting complex logic
> Computer programs
> Program flowcharts
> About LogicExtractor
> Code from flowchart

A Program Flowchart Symbol is a graphical representation of a of a categorical activity that can take place at a given point in time during the run of a program on a computer system. The use of flowchart symbols for creating and communicating flowchart documents have been standardised. Hence, there are standard symbols to be used when making a flowchart to communicate a program algorithm.

In this Tutorial you will learn about (1) How to identify and implement the basic control elements in a Program Flowchart (2) Evaluation of the Control Logic presented within a structured Program Flowchart, (3) How to design a structured Flowchart for a simple Program Problem (4) How to Write the Program code to a program solution with use of a structured Program Flowchart. (5) How LogicCoder implement these principles. (6) The structured approach to Program problem solution. (7) The Program Development Life cycle. (8) How LogicCoder/logicExtractor integrates the Phases of the Program Development Life Cycle.Use this link to convert your source code to LogicCoder and Ms Excel flowchart.


CONTROL ELEMENTS OF A PROGRAM LOGIC

The ability of the computer to fetch and execute instructions repeatedly, accurately and at very high speed coupled with its ability to make decision on alternative processing makes the computer appears to be a powerful device. The programmer writes code in a programming language that specifies what instruction is to be executed in a program. The kind of processing done by the basic control elements that determine branching during the sequence of program statement execution can be described as:

  1. Alternative processing or
  2. Repetitive processing.

Actually, both type of processing is base on a process of decision making. The difference is that the control path in one case does not lead to a repeat of processing done before. Alternative processing in a program is implemented using the control logic known as the case structure or the comparing logic structure. Loops are implemented using the loop logic structure.

EVALUATING THE CONTROL LOGIC IN A FLOWCHART

When interpreting the logic of a flowchart, traversal of this logic is from top-to-bottom, left-to-right, both right-to-left and left-to-right at case decisions, and bottom-to-top followed by right-to-left when terminating a loop. Therefore, evaluating the logic in a control structure can be determined by the basic rules that govern that structure. For example, the logic in a loop can be evaluated on the basis of the basic loop logic structure along with any other nested internal structures. We use an example program flowchart to illustrate these points.

EXAMPLE
An example program flowchart is illustrated by figure 2. In this system, a program is to be coded that reads sales persons record and then calculate sales commission base on individual sales value. A 7% commission is calculated if the sales value is greater than or equal to 500.00. Otherwise, the sales commission is calculated at 5%. The total of all commission is printed at the end of processing all sales record. The logic illustrated by the flowchart below gives a more concise description of the processes to be done on a computer system.


The implementation code in a source programming language is the actual instructions to the computer system that causes the intended processes to be executed by the system. In most case, the source code consist of high level instruction code that must be translated to machine level code before the program can be executed on a computer system. Some high level source language are specialise in their application and provides facilities to the programmer that results in convenient code development. When developing the logic of a software system to be implemented in a target source language, you should be aware of the available facilities in that source language.

 

 

 

.

However, with LogicCoder, you no longer need to be too concerned about details of the implementation control structures in the language once you have completed a proper design using a flowchart. The logic illustrated by a flowchart is then used to write the program solution in a selected programming language. For example, the logic illustrated by the flowchart in above can be implemented in C as illustrated below. Notice that the code does not deal with programming issues such as systems environment setting and pre-processing directives. These requirements are not documented in the flowchart.

THE C/C++ PROGRAM CODE

The programming language used to code the program logic will to a large extent be determine by the nature of the descriptive statements used in the flowchart and the nearness of their meaning to specific statements that can be implemented in a language that fits closely to these description. If the program logic is well-designed, then the implementation source code can be any programming language.

 

 

 

 

 

Therefore, good algorithmic description in a program flowchart is essential to good program documentation, maintainability and portability of their implementation. The illustration below is the implementation code in BASIC for the program flowchart illustrated above. Coding a program is an exact skill that a programmer must develop by paying careful attention to detail and the precise use of the syntax of a programming language. However, with LogicCoder you need not pay much attention to the syntax of a programming language.

THE BASIC PROGRAM CODE

Certainly! it is possible to implement the logic of a flowchart in Assembly Language using LogicCoder. In this case, the description of events illustrated in the flowchart would in most case refer to the hardware elements in the system on which the program algorithm is to be implemented.

 

 

 

 

FLOWCHARTING AS IMPLEMENTED IN LOGICCODER

LogicCoder implement the rules listed below. In addition, LogicCoder provides means whereby you can quickly generate source code in multiple source languages using a given flowchart. You can do easy modification to the existing logic of a software system and then generate new source code base on your modification. You need not pay much attention to the semantics of programming languages or the use of control statements in order to develop and implement complex logic systems. You can also easily port logic design from one source language to another whilst using the same system documentation.

BASIC RULES OF LOGIC CODER

LogicCoder is design to determine the flow of program control in a flowchart without the use of arrows on lines that interconnect symbols. You do not have to use arrowhead lines to determine the flow of program control. However, you must adhere to the following rules.

  • Every control logic structure must have a single entry and a single exit point.
  • The Entry point to a case or loop control structure must always be a decision
  • A loop control structure has its entry and exit points at the decision
  • Lines must not overlap or cross over except in the case of a loop where a single horizontal line terminates the loop on a vertical line that passes control to a Decision symbol.

DRAWING A FLOWCHART

LogicCoder provides five basic ways in which you can create a flowchart by interconnection of symbols.

  1. By using the mouse to select and then click symbols into their locations in the flowchart.
  2. By use of the free-mode option to attach flowchart symbols at selected points on other symbols
  3. By inserting control structures from templates.
  4. By editing a generic template structure so that the resulting control logic implement the required solution
  5. Edit an existing Control Logic in a flowchart

The tutorial Manual gives lessons to illustrate these three methods for drawing a flowchart.

CORRECTNESS OF LOOPS AND CASE STRUCTURES

Number of decisions in a nested case structure must equal number of connectors
2. Loops must have entry and exit point at their decision
3. Case structures nested within a loop must satisfy 1 completely within the loop.
4. Loops within a case structure must satisfy 2 completely within the case structure

Using the branch point principle given in LogicCoder may appear to be inefficient in the first instance. However, over the long term you will find that it is a highly productive restriction that avoids the development of complicated or difficult to edit control logic structures. The example flowchart below illustrates a temptation to violate the basic loop design principle. In this algorithm, a data file is to be used to create a report by repetitive processing of its records.

The alternative but incorrect logic implementation is illustrated below. The justification to use this implementation is that in looping this way you save on unnecessary coding. However, this is not the most efficient technique for saving on program code over the long run- In addition, "saving on program code" does not always result in a more efficient program. Using well defined control structures in a program design is a better aid to discovering ways for implementing efficient and correct program code. Because of the importance of the basic loop logic structure, two "Read a Record" processing statements are required in the program source code.

 


To pass back program control to the first command statement as illustrated in the figure below violates the rules of the loop control structure. In this implementation, the first statement in the loop is not a decision. The correct implementation follows the rule that the first statement in a loop should be the decision that determines whether the body of the loop is to be executed or not. The value of this rule is not immediately apparent in this simple example. It takes more complex algorithm to realise the soundness of this rule.

 

The information given here is only intended to be a guided sample of that to be found in LogicCoder's Technical Reference Manual. The information presented here is therefore incomplete. More detailed explanation of program flowcharting can be found in our teaching resources and the Technical reference manual.

 

 

 

 

 

 

 

A STRUCTURED APPROACH TO PROGRAMMING

 
     

LogicCoder supports a structured approach to the development of software systems. LogicCoder makes it easier for developers to document and maintain their software systems with less uncertainty, more consistency and greater control over the management of changes. Hence, both design and program maintenance are made easier. Correctness of a program can more easily be aligned with its algorithmic description. Structured programming languages generally emphasise the use of well-established control statements that implement well-established control structures. The layouts of program code in these languages emphasise and make it easy to deduce these control structures. This helps to enhance the readability of the program logic and the maintainability of the program code. LogicCoder generates code in conformity to these basic principles. However, you no longer needs to pay attention to these details when developing software systems.


E PROGRAM DEVELOPMENT CYCLE

The Program Development Cycle is the well-established standard approach towards the development of professional maintainable software systems. Because of the precise nature of the sequence and kind of instructions involved in the solution to a programming problem, it is important that the programmer approach the solution to a programming problem in a systematic and discipline manner. This systematic approach is called the program development life cycle. The program development life cycle consist of the following stages:

1. Review of program specification
2. Program design
3. Program coding
4. Program testing and debugging
5. Program documentation

REVIEW OF THE PROGRAM SPECIFICATION

The solution to a programming problem begins with a clear description of the problem to be solved. This includes the following:

  • The format and type of input data,
  • Processing to be done on the input data,
  • Format of the output created from the processed data.

A clear understanding of the program specification should be the basis for the programming problem solution. At this point, the programmer should have no doubt as to the format of the input data, the processing to be done to them and the format of the output from the program.

THE PROGRAM DESIGN

Correct programming is base on a scientific principle. The design of the program logic is in keeping with the set of program specification derived from the program review. The programmer must have knowledge and understanding as to how a given objective in the program specification can be implemented on a computer system.

THE PROGRAM CODING

The programmer uses the flowchart to code the program logic in an appropriate programming language. The descriptive statements used by the programmer in the flowchart in most case will be influence by the programming language to be used for implementation of the programming solution. If the program logic is well designed, the programmer should be able to code the program in any programming language and still obtain the correct results. Therefore, good algorithmic description in a program flowchart is essential to good documentation, maintainability and portability of their implementation. Coding a program is an exact skill that the programmer must develop by paying careful attention to detail and the precise use of the syntax of a programming language.

THE IMPORTANCE OF PROGRAM REVIEW

It is possible that a programmer from time to time will make errors in the logic design of a programming problem solution or in the syntax use of a programming language. Therefore, it is important that other programmers review a program before it is entered into the computer system. The program review is best done by people other than the programmer. A program review is not an exercise to critiqued a program, but an opportunity for classmate, or quality control people to benefit as a result of the following:

  1. A reviewed program should contain no error and will produce the correct result when it is run on the computer system.
  2. The programmer will spend less time and frustration in the process of testing and correcting the program.
  3. The person reviewing the program will benefit by seeing alternative approach to solving a problem. In the case where errors are discovered, the reviewer will avoid committing similar errors in their own programs.

Copy right © May 2002
Logic Code Generator
73A Oldfield Road
Harlseden
London NW10 9UT
United Kingdom

Tel: +44(0)208 451 5097


Select a version of LogicCoder for purchase.