Tutorial 4 of 7: HANDS-ON INTRODUCTION TO LOGICCODER

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

The Operational Principles of LogicCoder

As you will observe from our technical reference manual and from the experience of using LogicCoder, LogicCoder is design with sound technical and scientific principles. Operations implemented by LogicCoder are well designed and logically consistent. We present you with some of these basic principles in this section of the tutorial.

LogicCoder is a Programming, Documentation and Systems Development software. In this section of the tutorial we help you to better understand some of these principles to enhance your appreciation of the system and hence to ease your learning curve. We show the screen elements and function available in Logiccoder that you will be using in the next section of this tutorial.

A programmer does not need to have much knowledge of the syntax and semantics of programming languages. LogicCoder minimises the need for system documentation once a design solution is achieved.

At the end of going through these tutorials you should
Knowledge of the various interface elements to be found in the LogicCoder GUI system
Have basic understanding of the use and limitation of interface elements

Have an understanding of the basic principles to follow when designing the control logic of a loop, case decision or a switch case structure
Be able to list the set of standard ISO symbols used for representing Program Flowcharts
State the Advantages and Disadvantages of using Flowcharts to represent the Control Logic of a Computer Program

 

You get a free tutorial version of LogicCoder for ANSI C/C++ and BASIC programming whenever you make on-line purchase of any of the following books.

  • Structured Programming with BASIC I; ISBN 0-9544270-1-7; Price $44.00 USD
  • Structured Programming with ANSI C; ISBN 0-9544270-0-9; Price $56.00 USD
  • Object Oriented Programming with ANSI C++; ISBN 0-9544270-3-3; Price $66.50 USD

LOGICCODER AS A GENERIC SYSTEM

LogicCoder provides the following facilities that allow you to easily design, implement and use generic control logic structures to develop complex software systems accurately and quickly.

IGNORE STATE FOR SYMBOLS:
You can switch selected symbols into or out of an ignore state when generating a source program from a flowchart logic. When you place a flowchart symbol in the Ignore state, LogicCoder ignores the symbol when generating a source program from the flowchart logic. You can switch the symbol back to the normal state whenever you require. A null statement is inserted into the generated source program instead of the command statement in the flowchart symbol. You can not place a VLine, HLine, Connector, Terminal or Decision symbol in the ignore state.

INDETERMINATE SYMBOLS AND TEMPLATE STRUCTURES:
An indeterminate symbol is a symbol which type is unknown. This should not be confused with a symbol in the Ignore state. A symbol in the ignore state is any symbol that represents a process that can be described or implemented in a source language. When a symbol is in the Ignore state it becomes invisible to LogicCoder during source code generation. In this state, the symbol still has its original representation. However, an Indeterminate symbol is a symbol that does not represent any process but can be changed to any symbol that can be used to describe a process. Indeterminate symbols are used mainly in template structures to represent generic processes.

THE CHANGE SYMBOL MENU OPTION:
LogicCoder provides the Change Symbol Type function that allows you to change selected symbols type in a flowchart. For example, you can change a Processing symbol to an Input/Output symbol and so on. You can select a single symbol or group of symbols and do change to a single type. Therefore, you can use the existing logic of a flowchart to quickly implement a similar solution to a problem that requires slight changes in the kind of operations to be done.

SELECT AND ABSTRACT CONTROL STRUCTURE:
LogicCoder allows you to select a control structure within a flowchart logic and then abstract this control structure to a single flowchart symbol. You can also do the reverse. That is, you can expand the abstracted representation of an abstract predefine process to view the actual implementation logic. Therefore, if you have a complex control logic you can select and abstract control elements to create an overall control structure that is conveniently generic in form and that is easier to evaluate.

INSERT CONTROL STRUCTURE:
LogicCoder provides generic control structures that implement standard control logic. You first select a point in the flowchart where you want to insert a standard control logic. LogicCoder then allows you to select and edit the generic control structure to fit a specific requirement. Once you are finish editing the control logic structure, LogicCoder does necessary shifting of existing symbols in the flowchart and then inserts the control logic.

CREATE FLOWCHART FROM A TEMPLATE STRUCTURE:
LogicCoder provides several means by which you can quickly build complex flowchart algorithms. You can edit a template control structure to create solutions to many different programming problems of the same kind. You can also create your own template structures and then use them as required in your logic design. Template structures represent generic control logic. Later versions of LogicCoder allow you to insert a template structure as an abstracted predefined control logic. You always edit the template structure so that it implements a specific program logic solution before you save it as a flowchart.

SAVE FLOWCHART AS TEMPLATE STRUCTURE:
LogicCoder provides you with the Save As Template function in the File pull-down menu that allows you to save a logic design as a template structure. In this case, each symbol that represents a process in the flowchart is changed to the Indeterminate symbol. Therefore, the control logic determines the generic structure. In this way, you can derive the solution to a class of programming problems that have the same form in their control logic by deriving the solution of one such problem. You then edit the generic control logic to implement the solution for any problem within that class of programming problem. Symbols that represent a process in a flowchart are as follows. Input/Output Process Predefine Comment

MULTIPLE SOURCE CDE TEXT FOR A SINGLE FLOWCHART:
LogicCoder allows you to create more than one source program in a source language from a single control logic design. Therefore, you can have multiple source code views for a single flowchart. You select to save the source code text of a flowchart once you have created it. You can then empty the flowchart of its language source text and then create a new source code text using the same or a modify control logic. You choose to load a source code text file in order to do editing to it or to write a source program using the flowchart logic. However, you should note that once you change the control logic of a flowchart, if you then attempt to load the source code text file, source command statements may not be allocated to each symbol in the correct original sequence. In addition, any new symbol you insert into the flowchart will not have text stored in it. I.e. they will appear empty.

INSERT STANDARD CONTROL STRUCTURE:
LogicCoder provides standard control structures that you can insert at selected points in a flowchart. You select a point in a flowchart to insert a control structure. LogicCoder then allows you to edit the structure to fit a specific requirement. You can also create your own control structures and then use them as required in your logic design. Control structures like templates represent generic control logic. Later versions of LogicCoder allow you to insert a template structure as an abstracted predefined control logic. .

LOGICCODER USER INTERFACES

The original design for LogicCoder is intended for implementation on multiple operating systems. Current implementations are designed with a Graphical User Interface (GUI) that runs in a purely DOS or Ms Window environment. The following is a description of LogicCoder Ms Windows GUI.

LogicCoder user interface consists of standard Ms Window GUI objects for common Ms Windows type file operations. As can be seen in the following diagram, the top pane of the main user application interface consist of a standard application menu bar, followed by a familiar Windows type tool bar. This tool bar has icons for familiar document operations such as New document, Open document and so on. On the right hand side of this toolbar is a flowchart template. This template is a subset of the flowchart symbols available in LogicCoder.

There is also a flowchart template bar with standard ISO flowchart symbols as illustrated in the following image. GUI objects are designed to respond to standard mouse events in a familiar way. A shortcut menu bar is a list of shortcut buttons for performing common task on flowchart symbols within a document or on the text content of symbols. The shortcut toolbar is divided into two sets of editing functions. Those that do editing to symbols in a flowchart and those that do editing to the text content of flowchart symbols.

LogicCoder Ms Windows interface with sample flowchart document

THE GRID-LINES SUB-MENU OPTION
LogicCoder provides a grid consisting of vertical and horizontal lines in a document. The grid acts as a layout guide to the user. However, you can choose to switch on or off this grid system by selecting the Grid Lines menu item in the View pull-down sub-menu. Alternatively, you can use the shortcut button on the Toolbar.

HOW TO SWITCH ON OR SWITCH OFF THE GRID LINES
Select the View menu option on the main menu bar by clicking with the left mouse button or use the Right/Left arrow keys to highlight it and then press the Enter key once.
Use the mouse left button to select the Grid Lines sub-menu item or use the Up/Down arrow keys to highlight it and then press the Enter key once. If the grid lines are visible, they will disappear from the screen. If the grid lines are not visible, they will appear on the screen.

In addition, the Grid line shortcut button appear sunken whenever the grid lines are visible and un-sunken whenever the grid lines are not visible as illustrated in figure 39. This menu option toggles like a switch. Therefore, you can switch it off by selecting it again in the manner stated above.

How to switch grid lines on and off in LogicCoder

The following image describes the main user interface of the Ms Window version of LogicCoder. See figure 2 in user reference manual for more detailed information of each item on the shortcut edit toolbar.

Elements of LogicCoder Ms Windows user interface.

USER HANDS-ON ACTIVITY

Execute the LogicCoder application and examine those elements of the screen display in your application window to those displayed in the above images. Do not expect to see a copy of the flowchart document as in this diagram!.

EVALUATING THE CONTROL LOGIC OF A FLOWCHART

When evaluating the logic of a flowchart, traversal of this logic is done 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 the 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.

FLOWCHARTING IMPLEMENTED BY LOGICCODER
The system of flowcharting used by LogicCoder to illustrate the control and execution of a program on a computer system is concise and structured. There are rules that govern the ways in which you use the functions provided by LogicCoder. These rules are logical and consistent and in most case are intuitive to follow. LogicCoder implements the rules listed below.

RULES YOU MUST FOLLOW WHEN USING LOGICCODER
The following are rules that you must follow when designing program algorithms with the intent to generate source code. To generate a source program from a flowchart, LogicCoder must first determine that the flowchart is correctly connected together. LogicCoder is design to determine the flow of program control in a flowchart without the use of arrows. However, the following restriction results as a consequence.

Two or more symbols are connected whenever they overlap. Only line and non-line symbols should be interconnected in a flowchart. Any other kind of interconnection results in an interconnection error. Since no rotation on symbols is allowed overlapping can only occur with specific orientation of any given pair of symbols. Overlapping is two-dimensional and occurs only when the following conditions are satisfied:

CORRECTNESS OF SYMBOL INTERCONNECTION
Any selected point within the region of overlap is common to both symbols.

 

THE SWITCH-CASE STRUCTURE
There are programs in which the required processing at a given point in the control logic is to be determine by a sequence of decisions implemented by a sequence of nested case structures using a single control variable. Modern programming languages provides a control command statement that simplifies the implementation of this kind of nested case control structure. This multilevel nested case structure is called the switch-case structure. It has the general format illustrated in the following image. Note that the switch case structure also have single entry and exit points as with the case structure. The decision used in this case acts as a switching point in the control logic. It passes control to the appropriate sequence of command statements base on the value of a control variable.

General form of the Switch-case structure.

The switch case structure is a fine example of an abstracted view of a complex control logic structure. It is a generic control structure that has wide application. LogicCoder provides functions that allow you to abstract your own control logic structures and use them as templates for building other complex control logic structures. When drawing the switch-case structure there must only be three HLine symbols that enclose the execution paths through the structure. One that connects the entry to the execution paths in the structure and the two that flows into the connector symbol. You should always ensure that this is the case whenever you draw the structure.

DRAWING A FLOWCHART

The previous section gives a basic idea of the paradigm on which LogicCoder is base. This section gives more specific instructions on how to use LogicCoder to draw descriptive program algorithms and how to use the flowchart to generate implementation code in a selected programming language.

SELECTING SYMBOLS TO DRAW A FLOWCHART
LogicCoder provides different ways in which you can create a flowchart by interconnection of symbols. You can draw symbols in a flowchart document using any of the following methods. The tutorial section in this manual provides lessons that illustrate these methods for creating a flowchart.

HOW TO USE THE FLOWCHART SYMBOL TEMPLATE BAR
Use the mouse to select the symbol you want on the flowchart template bar and then click symbols in its location in the flowchart. You select the point in the flowchart document where you want the symbol to appear by clicking with the mouse left button.

How to use LogicCoder flowchart template to draw symbols

When you select a symbol on the symbol template bar, the selected symbol appears sunken as illustrated in the above image. If you then click the flowchart document view, any of the following will occur depending on where you click.
1. LogicCoder draws a copy of the current selected symbol with centre at the point where you click. A symbol is selected immediately after it is drawn. Therefore, you can move the symbol by pressing the mouse left button and then drag in the document view in the direction you want to move the symbol.
2. The symbol at the location you click is selected. When you do a mouse left button click, LogicCoder first check to determine if a symbol is at the mouse click point. If a symbol exist at the mouse click point, it is selected. Else if a symbol is selected on the template bar, a copy of the selected symbol is drawn at the mouse click point in the document view.

HOW TO USE A FLOWCHART CONTROL LOGIC TEMPLATE
Insert control structures into an existing flowchart or edit a template structure to create a problem solution.

A template flowchart

You edit a template structure or a standard control structure by replacing each Indeterminate symbol with proper flowchart symbols. The above image illustrates an example Template structure that can be edited to create a new flowchart. You must replace all Indeterminate symbols in a Template structure with proper flowchart symbols. Otherwise LogicCoder will replace them with lines whenever you save the flowchart or do certain other operations on the flowchart. When you select to create a flowchart from a Template structure, LogicCoder deletes the flowchart you currently have opened. Therefore, you should save this flowchart before you select to create a new flowchart from a Template structure.

SELECTING SYMBOLS IN A FLOWCHART

LogicCoder provides you with several alternative means for selecting symbols in a flowchart. You may want to select group of symbols base on the operation you wish to perform on them. For example, you may want to select a sequence of symbols that constitute a control structure that you want to abstract to a predefine symbol or you may want to select a set of symbols to write common text to them.

You select a symbol in a flowchart by clicking with the mouse left button. A symbol is selected if the point that you click falls within the area taken up by the symbol. You can also select symbols in a flowchart by tabbing. When a symbol is selected, it appears with an outlined rectangle around it as illustrated by the examples in figure 31. The colour of the symbol also changes from black to blue.

You drag within the rectangular region of a symbol in order to move the symbol. You can also move a symbol by selecting it and then pressing the appropriate arrow key for the direction in which you want to move the symbol. You can also move a group of symbols with each symbol kept in its relative position to other symbols in the group.

SELECTING MULTIPLE SYMBOLS
You can select more than one symbol with the mouse by pressing the Shift key and then click each symbol you want to select. You must first select the Auto-draw mode button before an attempt to perform this operation.

Selecting multiple symbols in a LogicCoder document.

Press the Shift key on your keyboard and then click each symbol you want while keeping the shift key down. Each selected symbol appears with a gold outlined rectangle around it.

You can also select more than one symbols by liaison with the Mouse. Press and drag the mouse left button so that the outlined rectangle that appears covers the set of symbols you want to select as illustrated by the example

PLEASE GET A HARD COPY OF LOGICCODER TECHNICAL AND USER REFERENCE MANUAL FOR MORE DETAILED AND CONCISE INFORMATION ON THE TOPICS HEREIN.

Go to the next sequenced page in this tutorial

Copy right May 2002
Logic Code Generator Ltd
142A Shenley Road
Borehamwood
Hertfordshire WD6
United Kingdom
Tel: +44(0)203 538 6133
E-mail: info@

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

 

 

 

Home | Contact us | Online Service | Links