[ieee 2006 international symposium on communications and information technologies - bangkok,...

4
1062 Visual Programming using Flowchart Kanis Charntaweekhun and Somkiat Wangsiripitak Computer Engineering Department, Faculty of Engineering King Mongkut's Institute of Technology Ladkrabang, Bangkok, Thailand E-mail: pakkardkawghotmail.com, somkiat kmitlgyahoo.com Abstract Nowadays a computer programming become the fundamental knowledge for people studying or working in a computer field, e.g. computer engineering, computer science, information technology, etc. Programmer not only considers the algorithm carefully but also performs the coding according to the syntax of programming language used. Therefore writing a computer program is a difficult task, especially for a beginner. In fact, a novice often uses a flowchart as a tool to help him summarize the idea into all necessary steps of solution, but this flowchart cannot be understood by the computer. It must be converted to the program by using some programming language and then be compiled and run. The visual programming using flowchart proposed in this paper allows the programmer to write the program in the format of flowchart, then compiles and run, without the coding step. There is no necessity to remember the syntax of any programming languages. It takes the benefits of easy-to-understand and easy-to-perform of the flowchart, whereas eliminates the weakness of a conventional programming, e.g. the requirement of remembering the syntax, the error in coding step. Furthermore, a debugging of program by the proposed system is straightforward and easy to discover the error. The proposed system could be used as a tool for teaching the basic concept of structural programming as well. Experimental results show the powerfulness, easiness, and user- friendliness of the proposed system. I. INTRODUCTION Computer is essentially demanded in many fields for the present. In finance, many computers are used in ATM systems and database systems. A lot of computers are used in data communication, the Internet, a mobile phone, even in an automatic washing machine. Most of people start using a computer in a role of the end user. Some of them want to be a programmer and/or a developer, and try to study how to write a program. Someone gives up because he found that the programming is hard to understand. Hence the programming is often a bitter experience for a beginner. There are more than 50 programming languages in the world. Some languages are used for general purpose whilst other languages are employed for specific purpose. These computer programming languages, however, are only the tools used for programmers to communicate with and order the computer to do as they desire. More important thing in writing a program is a design of an algorithm. An inexperienced programmer is always attracted by the syntax of the computer language, and overlooks the significance of algorithm design. The reason is that most errors occurring in the first compilation of the program written by the rookie often are the syntax errors. The immature programmer who is not familiar with the syntax of the programming language writes the wrong code frequently. These result from the inflexibility of the computer programming language. For instance, the case-sensitive in Java and C, the spacing effect to scoping in Python, and so on. Many times there is no compilation error in the code, but the logic error which is more serious mistake occurs. The difficulties of reading and understanding the program in the format of coding are the principal reason of this logic error. Using the flowchart to find the solution for the problem is the easy way to describe programmer's idea. Some programmers use the flowchart to organize the sequence of computation steps, and implement the code in accordance with that flowchart. The complicated task could be described easily in the visual form of easy-to-understand flowchart [1]. This flowchart is also used to teach the beginner how to write a program in addition to its use by the unskilled programmer. Even expert sometimes uses the flowchart to discuss about the algorithm with his fellow, and/or to debug the program. A study on teaching a computer programming to adult students shows that 20% of the beginners want to use real language to understand programming, 40°0 want to use flowchart, and 40%0 want to use pseudo code. All of them (100%) want to see the sample of the result in EXE so that they can see what the program looks like or should do [2]. These confirm that starting with the visual programming is better than beginning with coding [3]. Nowadays there are several tools for visual programming but those are used for specific purpose. The visual programming using flowchart proposed in this paper is a visual programming tool for general purpose. This paper consists of 5 parts. The first part is introduction. The second part shows the comparison between writing codes and drawing flowcharts. Then the concept of visual programming using flowchart is described in next section. The forth part demonstrates the result of some experiments. The conclusions are summed up at the end of this paper. II. CODING Vs. DRAWING FLOWCHART The conventional steps of writing a program are described as follows. 1. Drawing a flowchart to express the algorithm being used. 2. Writing codes according to the flowchart. 3. Using a complier and a linker to compile and link all source codes. 4. Testing and debugging a program. 0-7803-9740-X/06/$20.00 C 2006 IEEE F3B-3 ISCIT1 200(6

Upload: somkiat

Post on 10-Mar-2017

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: [IEEE 2006 International Symposium on Communications and Information Technologies - Bangkok, Thailand (2006.10.18-2006.09.20)] 2006 International Symposium on Communications and Information

1062

Visual Programming using FlowchartKanis Charntaweekhun and Somkiat Wangsiripitak

Computer Engineering Department, Faculty of EngineeringKing Mongkut's Institute of Technology Ladkrabang, Bangkok, Thailand

E-mail: pakkardkawghotmail.com, somkiat kmitlgyahoo.com

Abstract Nowadays a computer programming become thefundamental knowledge for people studying or working in acomputer field, e.g. computer engineering, computer science,information technology, etc. Programmer not only considers thealgorithm carefully but also performs the coding according tothe syntax of programming language used. Therefore writing acomputer program is a difficult task, especially for a beginner.In fact, a novice often uses a flowchart as a tool to help himsummarize the idea into all necessary steps of solution, but thisflowchart cannot be understood by the computer. It must beconverted to the program by using some programming languageand then be compiled and run. The visual programming usingflowchart proposed in this paper allows the programmer to writethe program in the format of flowchart, then compiles and run,without the coding step. There is no necessity to remember thesyntax of any programming languages. It takes the benefits ofeasy-to-understand and easy-to-perform of the flowchart,whereas eliminates the weakness of a conventional programming,e.g. the requirement of remembering the syntax, the error incoding step. Furthermore, a debugging of program by theproposed system is straightforward and easy to discover theerror. The proposed system could be used as a tool for teachingthe basic concept of structural programming as well.Experimental results show the powerfulness, easiness, and user-friendliness of the proposed system.

I. INTRODUCTION

Computer is essentially demanded in many fields for thepresent. In finance, many computers are used in ATMsystems and database systems. A lot of computers are used indata communication, the Internet, a mobile phone, even in anautomatic washing machine. Most of people start using acomputer in a role of the end user. Some of them want to be aprogrammer and/or a developer, and try to study how to writea program. Someone gives up because he found that theprogramming is hard to understand. Hence the programmingis often a bitter experience for a beginner.

There are more than 50 programming languages in theworld. Some languages are used for general purpose whilstother languages are employed for specific purpose. Thesecomputer programming languages, however, are only thetools used for programmers to communicate with and orderthe computer to do as they desire. More important thing inwriting a program is a design of an algorithm. Aninexperienced programmer is always attracted by the syntaxof the computer language, and overlooks the significance ofalgorithm design. The reason is that most errors occurring inthe first compilation of the program written by the rookieoften are the syntax errors. The immature programmer who is

not familiar with the syntax of the programming languagewrites the wrong code frequently. These result from theinflexibility of the computer programming language. Forinstance, the case-sensitive in Java and C, the spacing effectto scoping in Python, and so on. Many times there is nocompilation error in the code, but the logic error which ismore serious mistake occurs. The difficulties of reading andunderstanding the program in the format of coding are theprincipal reason of this logic error.

Using the flowchart to find the solution for the problem isthe easy way to describe programmer's idea. Someprogrammers use the flowchart to organize the sequence ofcomputation steps, and implement the code in accordancewith that flowchart. The complicated task could be describedeasily in the visual form of easy-to-understand flowchart [1].This flowchart is also used to teach the beginner how to writea program in addition to its use by the unskilled programmer.Even expert sometimes uses the flowchart to discuss about thealgorithm with his fellow, and/or to debug the program.A study on teaching a computer programming to adult

students shows that 20% of the beginners want to use reallanguage to understand programming, 40°0 want to useflowchart, and 40%0 want to use pseudo code. All of them(100%) want to see the sample of the result in EXE so thatthey can see what the program looks like or should do [2].These confirm that starting with the visual programming isbetter than beginning with coding [3]. Nowadays there areseveral tools for visual programming but those are used forspecific purpose. The visual programming using flowchartproposed in this paper is a visual programming tool forgeneral purpose.

This paper consists of 5 parts. The first part is introduction.The second part shows the comparison between writing codesand drawing flowcharts. Then the concept of visualprogramming using flowchart is described in next section.The forth part demonstrates the result of some experiments.The conclusions are summed up at the end of this paper.

II. CODING Vs. DRAWING FLOWCHART

The conventional steps of writing a program are describedas follows.

1. Drawing a flowchart to express the algorithm being used.2. Writing codes according to the flowchart.3. Using a complier and a linker to compile and link all

source codes.4. Testing and debugging a program.

0-7803-9740-X/06/$20.00 C 2006 IEEE F3B-3 ISCIT1 200(6

Page 2: [IEEE 2006 International Symposium on Communications and Information Technologies - Bangkok, Thailand (2006.10.18-2006.09.20)] 2006 International Symposium on Communications and Information

1063

Although the first step may be omitted by the skilledprogrammers, it is still used when they try to explain theiralgorithm to the others. The second step (Coding) is requiredbecause the algorithm must be expressed in the format thatcould be changed later into the commands that computer canunderstand. To perform the coding without any errors, theprogrammer must have the understanding of the syntax ofprogramming language used and be practiced enough. Thethird step (compiling and linking) is essential for allprogramming language, because those source codesimplemented in the second step have to be translated to the setof instructions which will later be run consecutively by thecomputer. Most programmers spend much time in the firstand second step because the conversion of idea into sourcecode is very hard when doing with complex task. Sometimesthey have finished coding but the compilation errors occur.Thus they have to spend more time finding the mistakes andcorrecting them. These compilation errors result from the lackof experiences and practices in coding. Unfortunately, after allcompilation errors are dissolved, the program may stillcontain the logic error. Finding and debugging this kind ofmistakes are often harder than does the compilation error, andfrequently require the comparison between the flowchart andthe source code to seek the difference between them in casethat there is no fault in the algorithm of the flowchart.On the other hand, if the programming task performed by

the programmer could be reduced to only 3 steps: (1) Drawinga flowchart, (2) Compiling and Linking, and (3) Testing andDebugging, some errors mentioned above will be excluded.This environment could be obtained by using the "VisualProgramming using Flowchart" proposed in this paper. Sincedesigning algorithms by drawing flowcharts is the basicmodel that developers use to draft their ideas on the paper,enabling the program creation by compiling and linking theflowcharts is straightforward and makes the debuggingbecome simpler because of its visual form.

The flowchart used here is the same as usual. It expressesthe flow of process like a water flow. The processes work stepby step along the arrows. When it encounters a decisionsymbol which has two or more branches of the next steps, itwill proceed to one of the next steps according to the result oftesting criterion(s). This way of programming and debugging(in the expression of flowchart) is easier and takes shortertime to perform, understand, and search for any errors in theprogram than the conventional programming technique does.As the visual programming using flowchart has no need towrite the code for the flowchart, the programmer are nolonger required to remember the syntax of computer language,and the system guarantees that no compilation error canappear in the coding step (In fact, there is no step of coding).In addition, the readability and expressiveness of the programwritten in the proposed system are improved over theconventional programming system.

In the next section, the concept of visual programmingusing flowchart is explained in details.

III. CONCEPT OF VISUAL PROGRAMMING USING FLOWCHART

The main concept of visual programming using flowchart isto utilize the advantage of flowchart, i.e. the expressiveness,the effectiveness, the visualization, and the ease of algorithmdesign, implementation, and debugging. The programmer justdescribes his idea and algorithm easily by drawing theflowcharts, and then compiles and links all flowcharts tocreate EXE file. The required steps for programming in theproposed system are as follows.

1. Drawing flowcharts by using the drawing tool.2. Compiling and linking all flowcharts to make EXE.3. Testing and debugging a program.The other things the programmer may need to perform are

correcting (1) the format error, which results from anerroneous drawing component, and/or (2) the logic error,which results from the inaccurate design of algorithm. Thestep of coding required in the conventional programmingscheme becomes unnecessary for the programmer; however, itis still carried out quietly in our proposed system by means ofa translation module. The translation module implemented inour proposed system will translate all flowcharts into Csource codes. Moreover, when the programmer compiles andlinks all flowcharts in our proposed system, the C compilerand linker, which are transparent to the programmer, will beused quietly inside the system to perform the compilation andlinking of those C source codes. These steps are depicted inFig. 1.

(a) flowchart (b) source code in C (c) EXE file

Fig. 1. Process of program development in the environment of VisualProgramming using Flowchart system (the step in shade area istransparent to the programmer).

When a programmer sends a "run" command to the system,the system will, first, check the integrity of all associated files,e.g. the identicalness of last modified time of flowcharts andC source codes, etc., and recompile and/or relink the files ifnecessary. Then, the EXE program will be invoked, and theoutput will be sent to display on the environment of visualprogramming using flowchart. If some inputs are required,our proposed system will act as an interface, i.e. it will receivethe inputs and pass them to the EXE program for execution.

IV. SYSTEM IMPLEMENTATION

There are 3 major modules implemented in the proposedsystem: (1) flowcharts drawing tool, (2) compilation andlinking tool, (3) execution and debugging tool. These tools areincluded in the environment of the visual programming using

Page 3: [IEEE 2006 International Symposium on Communications and Information Technologies - Bangkok, Thailand (2006.10.18-2006.09.20)] 2006 International Symposium on Communications and Information

1064

flowchart. The user interface of the proposed system isdepicted in Fig. 2. The details of each tool are described in thefollowing subsection.

Fig. 2. Visual Programming using Flowchart Environment

A. Flowchart Drawing ToolThe drawing tool is responsible for all tasks concerning the

drawing objects. It also checks whether all constraints ofdrawing are satisfied. The representation of drawing object ismanaged by this tool as well. In the view of programmers,

they use this tool to draw symbols, add, select, move, delete,and/or edit objects. This tool provides all basic symbolsusually used in the flowchart, e.g. a process symbol, a flowline, a decision symbol, a connector symbol, a start & stopsymbol, an input symbol, and a subroutine symbol. Each ofthem has its own constraints. For instance:

c Flow line has the object connected at both end.c Process symbol, input symbol, and subroutine symbol

have one "in" flow line and one "out" flow lineconnected.

c Decision symbol has one "in" flow line and two "out"flow lines connected. One "out" flow line is reservedfor a true condition. The other is reserved for a falsecondition.

a Connector symbol has one or two "in" flow lines andone ''out" flow line connected.

a Start symbol has only one "out" flow line connected.a Stop symbol has only one "in" flow line connected.In the proposed system, each visual symbol and its

connections are represented in the string format so that thecomputer is able to understand the meaning and therelationship between each symbol. The exempla of datastructure for each kind of symbol are as follows.

* Process, connector, start, stop, input, and subroutinesymbol is represented as

symbol type [11] symbol ID [11] position [11] text[11] next symbol ID [11] no. of "in" flow line [/end/]

* Decision symbol is represented as

symbol type [11] symbol ID [11] position [1] text[I!] next symbol ID when condition is true [I!] nextsymbol ID when condition is false [11] no. of "in"flow line [/end/]

* Flow line is represented as

symbol type [11] symbol ID [11] start symbol ID [

stop symbol ID [11] status (true or false) [/end/]The above representation of data structure for symbol is

employed for a computer not only to recognize the symbol butalso to save the flowchart itself for later use. These

representations of all symbol objects in a flowchart will besaved in a file with "vpf' extension.Each "text" property in the description of each symbol has

its unique meaning. The meaning of "text" property in eachsymbol representation is listed below.

* For process symbol, it is a statement. The programmercan use any standard functions in C language or anysubroutines, which in fact is flowcharts, defined in theproposed system.

* For input symbol, it is a variable name.* For decision symbol, it is a condition expression.* For start symbol, it is an input argument.* For stop symbol, it is a return value.* For subroutine symbol, it is a filename of flowchart

implementing a desired subroutine.

Fig. 3. A condition symbol with the condition "a< 5"

Fig. 3 shows the example of condition symbol with one"in" flow line, two "out" flow lines, and the condition "a<5".

B. Compilation and Linking ToolThe input data of this tool are all related flowcharts drawn

in the flowchart drawing tool. This tool is responsible for 3principal tasks:

1. Checking the completeness and correctness of theflowchart.

2. Translating the flowchart into C source code.3. Using C compiler and linker to compile and link all

files and then create EXE program.Several issues must be verified in the task of checking.

Some are stated below.* There are only one start symbol and only one stop

symbol in a flowchart.* There is at least one path from the start symbol to the

stop symbol.* Every path has the end at the stop symbol.* All constraints of each symbol are satisfied.On the other hand, the process of translating checks all

syntaxes in "text" property of each symbol object. Since thestatement used in flowchart is flexible for easy use, thetranslator module must be intelligent enough to change thisflexible statement into a C standard statement. All variablesused first time in the flowchart must be translated into thedeclaration statement of the correct data type as well. Thevariable scope should be considered carefully according to theintention of programmer. This translation module performsthe translation on all symbol objects, including the conditionsymbol, the iteration block, the subroutine symbol, etc.As described above, one of the 3 principle tasks of this tool

is compiling and linking by using a C compiler and linker.This implies that the C compiler and linker must have been

Page 4: [IEEE 2006 International Symposium on Communications and Information Technologies - Bangkok, Thailand (2006.10.18-2006.09.20)] 2006 International Symposium on Communications and Information

1065

embedded in this tool. However the user of this system isusually not aware of the existence ofC compiler and linker.

C. Execution and Debugging ToolThis tool consists of two modules: (1) normal execution

module, and (2) debugging module. The normal executionmodule is used to run the program from the beginning to theend in one step, whereas the debugging module is used to runthe program step by step. The latter module is useful when theprogrammer want to confirm the correctness of the algorithm,search for the bug, and monitor any changes being take place,when the program runs step by step. The symbol which isbeing executed right now will be highlighted.

V. EXPERIMENTAL RESULT

The proposed system is examined by drawing 5 flowcharts,compiling and linking them one by one, and executing anddebugging them one after another. The 5 flowcharts used inthe experiment are as follows.

1) Flowchart with condition symbols. Both basic if-elseand nested if-else are included.

2) Flowchart with iteration blocks. A normal while loop,a do-while loop, and a nested loop are included.

3) Flowchart with condition symbols and iterationblocks. Both symbols from 1) and 2) are included

4) Flowchart with subroutine symbols. A subroutinesymbol and a subroutine symbol with arguments andreturn value are included.

5) Flowchart with a condition symbol, an iteration block,and a subroutine symbol. All symbols from 1), 2), and4) are included.

Stop

(a) flowchart

kinclude <stdio.h>

int main(int argc, char *argv[])

int a;printf("Input a value"),scanf("%d"`&a);if (a<5)

printf("a less than 5"),Ielse{

printf("OKC");,Ireturn O,,

(b) C source code

Fig. 4. Result of translation module

All experimental results show that the proposed systemcould be used to write a program for general purpose as theconventional programming could. From the experiments, theprogrammer could create the program without the coding stepusually required in the conventional programming. Thismakes programming by the proposed system simpler than

those done by the old fashion. In addition, programming bydrawing a flowchart is straightforward, i.e. the programmercould see and understand intuitively how the programproceeds.As described in the previous section, the proposed system

has the feature of translating a flowchart to a C source code.This function is usually hidden within the compilation andlinking tool. However, to verify the correctness of thistranslation, the translated C source code could be exported tothe file. Fig. 4 shows the example of translating a flowchartinto a C source code. The correctness in translation could beconfirmed in this figure. Furthermore this translation modulealso implements the indentation of statements for readability.One example of the experiments on the execution and

debugging tool is shown in Fig. 5. As shown in Fig. 5, thecurrent status of the program could be understood at first sight.There is no need to imagine the flow of program as usuallydoes in the code view of the conventional programming. Thisproves the powerfulness of visualization effect used in theproposed system.

Fig. 5. Some stages of the execution and debugging tool.

VI. CONCLUSIONS

The visual programming using flowchart is the best way forthe beginners to create a program for general purpose. It issuperior to the conventional programming system inreadability, ease-to-debug, effectiveness, and user-friendliness.The proposed system is practical and useful to be used as apowerful tool for algorithm design and program development.Debugging by this system is also easier than the old fashion,since each step of execution could be traced by monitoring theflowchart itself. Even an experienced programmer may usethe proposed system to solve the complicated problem, ordemonstrate and explain the idea to the other. Moreover it canbe used as a tool for teaching a computer programming.

REFERENCES

[1] Geoffrey G. Roy, Joel Kelso, Craig Standing, "Towards aVisual Programming Environment for Software Development,"Proceedings on Software Engineering: Education & Practice,1998, pp. 381-388.

[2] Min Hu, "A Case Study in Teaching Adult Students ComputerProgramming", Proceedings of the 16th Annual NACCQ,Palmerston, North New Zealand, July 2003, pp. 287-291.

[3] Marian G. Williams, William A. Ledder, "Visual PrgrammingLabs for Introducing Computer Science Concepts", Frontiers inEducation Conference, 1993, pp. 797-802.