THE AUTOMATED FLOWCHART DESIGN AND CODE WRITING SYSTEM

  • Home
  • About LogicCoder
    • About LogicCoder
    • Screen Shots
    • About Program Flowcharts
    • Sample xls/wrd Flowcharts
    • Large Program Flowcharts
    • Sample Program Problem
    • Convert your Source Code
    • Make a Suggestion
  • Related Services
    • Free downloads
    • Code Translation
    • Code to flowchart
    • Tutorials
    • Flowchart search
    • Algoritms + code search
    • Shop for Resources
    • Download flowchart+code
    • Request file translation
    • Download sample books
    • Do business with us
  • Tutorials
    • Flowchart Tutorial
    • Flowchart Lesson 2
    • LogicCoder Tutorial
    • LogicCoder: Lesson 2
    • LogicCoder: Lesson 3
    • LogicCoder: Lesson 4
    • More Tutorials
  • Sorting Problem
    • About the Problem
    • Using Merge
    • Kronrod's Idea
    • Best Merge Algorithm
    • Analysis of 2-D Sorting
    • Other Merge Algorithms
    • Download sorting info
  • Register/Login
    • User Login
    • Request registration
    • Useful logout

 

Copyright 2001 (c) Logic Code Generator Ltd; You must not take information from this web page and reuse without the owner's permission!

LogicCoder on-line Tutorial

PRINCIPLES OF PROGRAM FLOWCHARTING

This section gives a concise introduction to the concepts and principles of flowcharting as a means for illustrating program algorithms to be executed on digital computer systems. The main objective is to help you understand the basic principles on which Logic Coder operates and to provide you with a conceptual guide for design of your program algorithms. This on-line documentation is not intended to be a detailed practical guide. Reference sources that gives more practical learning material including programming language concepts and design techniques are given at the link to additional learning resources.

WHAT IS PROGRAM FLOWCHARTING?

Program flowcharting is the art of illustrating program algorithms graphically using standard symbols and their interconnection. A computer program algorithm is the sequence of logical steps that must be executed on a machine in order to derive the solution to a programming problem.

There is no known standard accepted technique that restricts the design of program flowcharts using standard flowcharting symbols. In LogicCoder there are restrictions that the user must follow before program code can be generated by the system from a design. These restrictions may appear to be counterproductive when deriving the design for certain programming problems. In this case, the programming problem is usually trivial in nature. However, years of teaching and programming experience have shown that the advantages from the approach used in LogicCoder strongly outweigh the disadvantages. These rules ensure that all control logic structures are well defined, can be easily identified, edited or abstracted. In later version of LogicCoder we show how these rules are developed further to create data flow diagrams and for identification of parallelism in an algorithm. Hence, LogicCoder provides facilities for you to convert elements of a uni-processor algorithm to one that can be implemented on a parallel system. We define a uni-processor algorithm as an algorithm which when implemented on a Digital Computer System under the Stored Program Concept, is executed in time sequence as determine by its flow of control logic. At any instance in time, the system is executing only one intended instruction or group of instructions associated with the flowchart logic. Each symbol in a flowchart except connectors and lines represents a process that can be implemented on a digital computer that operates under the stored program concept. In this system of flowcharting, there are only three basic kinds of control logic structures

  1. Sequence - for executing a list of processes in time order

  2. Loop - for repetitive processing in time order and

  3. Case - for making decisions on alternative or complex selection processing

The manner in which these restrictions are implemented in LogicCoder are hinted at in the rules given in the following sections.

ADVANTAGES OF FLOWCHARTS FOR PROGRAM DESIGN

I have listed here, some of the advantages from using flowcharts.

  • They are self-documenting.

  • Allow easy review and maintenance of a software system. This results in less time spent on debugging

  • Helps to develop reusable algorithmic structures hence they are useful for identifying the logic of generic systems. Hence they help the user to develop concise generalize algorithmic solutions to similar problems.

  • Force careful and concise solution to the logic of a program problem.

  • A simplified consistent means for developing program logic

FLOWCHARTING SYMBOLS

You show the flow of program control in a flowchart by connecting flowcharting symbols together in a systematic manner. Each non-line symbol except for connectors in the flowchart represents some processing to be done at that point in the program. Each symbol represents a specific kind of operation that can be done on the computer. The symbols illustrated below does not exhaust those used in many technical documentation on computer systems. Symbols used in some documentation are appropriate to the kind of operations on computer systems they are intended to represent. The set of flowchart symbols illustrated below are appropriate to the kind of operations implemented by LogicCoder. However, LogicCoder has variant of these symbols that represents operations unique to Logic Coder. The most commonly used flowcharting symbols and a brief explanation of their use is listed below.

 

PROCESSING

Indicates process such as calculation, Data movement or any other kind of internal processing that affects the value of data in a program.

INPUT/OUTPUT

Indicates the point in the program where data is made available to the program through some input device or where processed data is made available for output from the program. Logic Coder provides additional Input/Output and Process symbols that can be used to illustrate more complex or specific kinds of Input/Output or Process operations in a flowchart.

DECISION

Shows the point in the program execution sequence where a jump takes place base on the outcome of a tested condition. In Logic Coder, Decision symbols are used only for establishing loops, case and switch-case structures.

CONNECTOR

Shows the exit from a case, a switch-case control structure or a common point where two or more control logic merges to create a single flow path. Logic Coder uses two concentric circles to distinguish a normal connector from a Switch Case connector. The Switch Case connector is illustrated and explained below.

TERMINAL

Shows the start or end point in the flow of control logic in a single flowchart. A complete flowchart must always have only one terminal symbol that indicates its beginning and a terminal symbol that indicates its termination. Logic Coder looks for a terminal symbol that indicates the start of the flowchart when doing an interconnection operation.

PREDEFINE

Shows a series of predefined processes that can be encapsulated as a single process and therefore represented as a subroutine, i.e. function, procedure or method. Logic Coder also uses the predefine symbol to represent an abstracted control structure. The detailed logic of the control structure is preserved.

INTERNAL STORAGE

Shows an output operation where data is stored internally on the computer system. This storage is usually on a mass storage device such as a Hard disk or CD ROM. Logic Coder does not use this symbol.

PAGE CONNECTOR

Used in multi-page documents to show the point in the program logic where control is pass from the logic on a given page to the logic on another page. Use this symbol when you need to restrict the size of your flowchart document. This may be due to the fact that you ant to print your flowchart on a printer that is restricted. However, Logic Coder will not be able to connect a flowchart that uses the off-page connector symbol.

ARROWS

Shows the flow of program control or data flow. Flow-lines can have any one of four directions. Logic Coder does not use arrows to determine the flow of control logic in a flowchart. The way this is done is explain further on in the manual. Logic Coder provides a function that you can use to see the flow of control logic in a flowchart as determine by Logic Coder.

COMMENT

Used to show points in the program logic where comments are written for the purpose of internal documentation. Logic Coder insert comments written in this symbol into the generated source program.

ADDITIONAL SYMBOLS USED BY LOGIC CODER

LogicCoder uses additional symbols. These symbols are usually composite or variant of existing symbols. Therefore, their usage and meaning is easy to follow and understand. Composite flowchart symbols are also called compound symbols. LogicCoder provides function that allows you to fragment a compound symbol into its constituent. Composite symbols are useful for drawing large or complex flowcharts quickly. The variant symbols are listed below.

LOOP DECISION

CASE DECISION

SWITCH-CASE DECISION

START TERMINAL

END TERMINAL

SWITCH-CASE CONNECTOR

ABSTRACTED PREDEFINE

INDETERMINATE PROCESS

INPUT-PREDEFINE PROCESS

OUTPUT-PREDEFINE PROCESS

PREDEFINE CASE STRUCTURE

PREDEFINE LOOP STRUCTURE

PREDEFINE SWITCH-CASE STRUCTURE

PREDEFINE VERTICAL/HORIZONTAL SEQUENCE

MULTIPLE COMMENT LINES

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 specialize 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 Logic Coder, 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 preprocessing 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 of the system on which the program algorithm is to be implemented.

FLOWCHARTING AS IMPLEMENTED IN LOGIC CODER

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 document.

  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 realize the soundness of this rule.

The information given here is only intended to be a guided sample of that to be found in Logic Coder'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 emphasize the use of well-established control statements that implement well-established control structures. The layouts of program code in these languages emphasize 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.

THE 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.

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 Ltd
142A Shenley Road
Borehamwood
Hertfordshire WD6
United Kingdom

Tel: +44(0)203 538 6133

You must not take information from this web page and reuse without the owner's permission!

 

Home | Contact Us | Online Service | Links