BBVPL: A Block-Based Visual Programming Language Built On Google's Blockly
BBVPL: A Block-Based Visual Programming Language Built On Google's Blockly
ABSTRACT fields. Java, Php, Python, etc. are a few examples of TPLs [1].
On the other side, VPLs provide a visual interface that
The paper presents a Block-based Visual Programming facilitates the users by manipulating program elements
Language (BBVPL) built on an open-source Google’s Blockly graphically [2]. VPLs use visual syntax that represents
Framework. BBVPL inherits Blockly’s alive features as well terminals in the form of pictures [3]. Software developers
as provides new functionalities. Although, the existing Visual solely need to drag-drop visual elements [4] on a canvas to
Programming Languages (VPLs) such as Flowgorithm, create, modify, and design pictorial program structure. A lot of
Raptor, Flint, Larp, Snap, Scratch, Kodu, Blockly, and many VPLs are accessible to educational and professional
more, provide a graphical computer programming interface for programming purposes. Flowgorithm, Raptor, Visual Logic,
learning and educational purposes. Some of them are used for Scratch, Blockly, Kodu, Microsoft VPL, EToys,
kid’s games and robotic applications development and others TouchDevelop, GameSalad, Open Roberta and Lego
for general- purpose programming. But they lack fundamental Mindstorms are a few examples of Visual Programming
programming capabilities mostly being used to teach basic Languages [5]. A programming language, either a VPL or a
programming concepts. Therefore, the feature enhancement TPL should provide competence to create arrays, custom
approach has used, and new iconic vocabulary and grammar modules, the user’s defined data types and file handling [6]. It
created by Blockly’s Block-factory module to develop a new should provide an interactive input-output (I/O) interface,
language (BBVPL). In this paper, BBVPLs programming exception handling, multithreading, and debugging
features have introduced to teach computer programming skills, capabilities. The surviving VPLs lack fundamental
especially for beginners in computer science. The BBVPL programming features discussed earlier [7]. So, the time is to
provides an intuitive visual drag-drop program development propose an all-in-one VPL that can provide an interactive user
interface and a user-friendly console for input-output (I/O). It I/O with proper file handling. A VPL that can manage object
offers essential programming features, including Object orientation, lists of data, customized modules, exceptions and
Orientation, Modular Support, Conditions (If-Else), Loops debugging capability to grip bugs and errors.
(For, While), Exceptions (Throw, catch, Finally), and File
Handling. However, the BBVPL can translate Visual Program Google’s Blockly [8], [9], an open-source framework, is
into Textual Program that will execute, and results will be provided with visual block-based icons and a drag-drop
shown on the console screen. To accomplish this, some programming environment. A computer programmer selects
experimental visual programs and their translated textual codes desired visual blocks and connects them at the pro- vided
are also part of our paper, indicating the smooth working of our platform according to the Blockly’s syntax and program’s
tool. The integration of user’s roles and rights management that logic. Blockly also permits the transformation of visual
will provide proper user access to save their programs on the programs into corresponding textual codes, e.g., JavaScript,
server, debugging, and multithreading features will be the parts Php, Python, Dart, and Lua [10]. It executes visual programs
of BBVPL in the future. and empowers to design a new Visual Programming Language
(VPLs). Existing Blockly pro- vides various features including
Keywords: Textual Programming Languages (TPLs), Visual arrays creation, conditions, loops, custom modules, and input-
Programming Languages (VPLs), Open Source, Web-based, output (I/O). Still, some critical programming concepts are
Interactive input-output (I/O), Exceptions, Debugging, missing, just as users defined data types, exception handling,
Multithreading, Block-based Programming, Visual file handling competency [11], debugging, and multithreading
Programming and user interface support.
2524
Ashfaq Ahmad et al., International Journal of Advanced Trends in Computer Science and Engineering, 10(3), May - June 2021, 2524 – 2532
with proper availability of try-catch blocks. It has all-inclusive used to teach programming concepts and provided sequential,
functionalities related to files, including open file, close file, selection, and repetitive structures for computer programming.
read line, read char, write line, seekp, seekg, tellp, and tellg Hooshyar and et. al., in their paper [18], emphasize that Raptor
along with others. Although input-output (I/O) feature is and similar visual programming tools enhance the
available in Blockly, shown in Figure 1, it is a discomfort to understanding of novice programmers. Raptor as a CS0 [19]
watch a lot of pop-ups and alerts on screen for I/O. BBVPL course, provides arrays, object orientation, modular support,
also enables an interactive console-based I/O facility as well. file input/output, and debugging services but lack of exception
handling features and threads creation. The primary purpose
of Raptor was to enhance solving skills of student’s problems.
Its stable release of 2015 is freely available [20].
2525
Ashfaq Ahmad et al., International Journal of Advanced Trends in Computer Science and Engineering, 10(3), May - June 2021, 2524 – 2532
Stencyl was published in 2011 for kid’s game Perl, Java, etc. The existing features of the Flowgorithm are
development [32]. It can manage to create 2D games for the array creation, modular support, graphical variable window
web and mobile devices. Aside from icon palate contains watch, multilingual support, loop, flexible expressions,
resources and logic to create an actor and sets its behavior. A recursion, and understandable interactive output [40].
user may define backgrounds, tiles, and sounds, to plan more
attractive games [33]. It provides intuitive tool-set and best 3 BLOCKLY’S EXISTING FEATURES
drag-drop interface to accelerate workflow. Stencyl supports
comprehensive deployment platforms including IOS Google’s Blockly Library based on JavaScript is an open-
(iPhone/iPad), Android, Windows, Mac, and Linux. Still, source framework that activates the development of new
there are some deficiencies in the above-defined Visual Programming Languages (VPLs). Blockly also
characteristics, essential for the completeness of a VPL [34]. provides a drag-drop platform to develop a visual computer
program by using its built-in visual icons. It can generate
In 2012, Google developed Blockly, an open-source textual code in different languages including JavaScript, Php,
VPL similar to scratch. A user may create a program using Python, Lua, and Dart. It can be used to create custom
Blockly provided web-interface and he is capable of executing generators of other TPLs as well [11]. It provides a toolbar,
as well as translating it into JavaScript, Php, Dart, XML, and including the “Logic” group, which holds conditional blocks,
Python [10]. A drag-drop environment with a connection point e.g., If-do, If-Else, Else-If, etc. Blockly implemented transitive
attached to each block enables to chain together on screen. connections [41], in which block makes connections according
Blockly is neither a full application nor a language that is ready to the designed language grammar or syntax and a sound
to use for end-users. It is a platform where users can work with produces that indicates the creation of a correct block couple.
an already built-in set of vocabulary (visual icons or blocks) The “C” shaped block in Blockly enables loops, e.g., “For
as well as can create their visual blocks and can associate code Loop”, “While Loop”, and “For Each Loop”. It allows putting
with each of them accordingly. Blockly provides arrays, loops, repetition statement blocks inside the “C” shaped block.
modular support, conditions, and others. Still, it surpluses to
enable interactive user I/O interface. It shows Java Script’s “Math” group contains mathematical visual blocks to
alert pop-ups to represent output of the program instead of a calculate random numbers, square root and to perform
proper black screen console. Moreover, exception handling, addition, subtraction, division, and similar operations.
multithreading, debugging, structures, object orientation, and Trigonometric functions, e.g., sine, cosine, and tangent are also
file I/O services are missing segments, that are necessary for part of this collection. It has the proficiency to create variables,
the completeness of a language [11]. arrays, and lists. Blockly provides the user’s input-output (I/O)
capability using windows alerts and prompts. In Blockly’s
Lego produced a hardware-software platform Lego toolbar, the “Text” group contains a “print” block connects
Mindstorms EV3 in 2013, for the development of a robotic with a “variable” or a “string” block to display values, while
application for Lego building blocks. Robot development is the “prompt” block prompts a message and stores inputted
the primary step using Lego bricks, motors, wheels, sensors, value of a variable shown in Figure 1.
etc. Then a user has to download EV3 [35] application for
PC/MAC or Tablet to write a program. The software facilitates Blockly’s “Functions” group provides modular
with a toolbar, full of functional blocks and drag-drop functionality. Again the “C” shaped visual “do something”
capability that enables a developer to join different activates. block allows us to create functions and return values. It does
A programmer can bring life into a robot by controlling motors also permit the user to put related visual statements in- side.
and sensors programmatically [36]. Blockly provides a drag-drop platform as well as a textual
language generator framework that translates the visual code
Visual Logic, another intuitive graphical flowchart- to TPL’s, e.g., JavaScript, Lua, Dart, Php, Python, and XML.
based VPL, developed to teach students diagrammatically. A It can also execute translated JavaScript code [42] by clicking
graphical interface that provides essential programming the rightmost “Run” button as well. Blockly also provides pop-
concepts including variables, arrays, pre-and-post test loops, up-based input-output (I/O) facilities. Its imperative visual
if-else conditions, procedures, debugging, and enhanced I/O icons are shown in Appendix A.
facilities from console and text files as well. It uses minimal
syntax and clarifies the program logic and concepts rather than
4 METHODOLOGY
focusing on program syntax. But its major drawback is
operating system dependency, it is functional only for
It’s all starts with an open-source Google’s Blockly
windows OS [37]. It has the proficiency in executing
framework that is not only a visual programming platform but
flowcharts but object orientation, exception handling, and
also a library that allows developers to create their visual
multitasking features are not developed in it. The latest version
languages [8]. Block-based Visual Programming Language
was launched in 2014 [38].
(BBVPL) is implemented by using the Blockly framework, so
it presents interface similar to Blockly but with more
Flowgorithm, designed by Devin Cook was a free
programming features including structures, exceptions, files,
application, first appeared in 2014. It is a graphical tool that
and interactive console integration. Blockly’s block factory
allows developers to write and execute a program with the help
module [12] was used that enabled us to create an iconic
of flowcharts [39]. Classical flowchart symbols appear in a
vocabulary and language syntax for BBVPL. Then the newly
toolbox; a user solely needs to drag and drop them instead of
created connectable visual icons became part of BBVPL. The
writing the bulk of instructions. It provides an easy way to
three-step program execution life cycle shown in Figure 2, in
write a computer program that can execute directly as well as
which the first step is to connect visual blocks to create a visual
can translate into other source languages like C #, C++, Python,
2526
Ashfaq Ahmad et al., International Journal of Advanced Trends in Computer Science and Engineering, 10(3), May - June 2021, 2524 – 2532
program. Secondly, the visual program translates into program’s output and to deal with the desired input. The
JavaScript textual code, and in the third step, translated code console application is the HTML web page based on
executes, which is further communicating with the console JavaScript. Figure 3 is presenting a sample BBVPL’s program
application for input-output (I/O) purpose. that requests the user to input two numbers, takes the sum of
them, and prints a message on the console if the sum is greater
BBVPL comes up with a console gadget for interactive than 10. Figure 4, presents the console’s output and preferred
user input-output (I/O). It is an open-source console template input as per the program’s logic.
that is modified according to BBVPL’s requirement. The
visual block program, translated into JavaScript executes and
communicates with black console screen to print outputs and
to deal with inputs. Figure 2 is screening the complete
BBVPL’s program execution life cycle. Then the software-
testing phase started, in which complex program scenarios
tried to execute and corrected reported bugs. Finally, the
complete web application BBVPL deployed on a server to
provide user access.
5 BLOCK-BASED VISUAL
PROGRAMMING LANGUAGE
(BBVPL) FEATURES
2527
Ashfaq Ahmad et al., International Journal of Advanced Trends in Computer Science and Engineering, 10(3), May - June 2021, 2524 – 2532
2528
Ashfaq Ahmad et al., International Journal of Advanced Trends in Computer Science and Engineering, 10(3), May - June 2021, 2524 – 2532
1 Try
2 Throw
3 Try Catch
4 Try Finally
2529
Ashfaq Ahmad et al., International Journal of Advanced Trends in Computer Science and Engineering, 10(3), May - June 2021, 2524 – 2532
related visual blocks shown in Figure 11. Table 3 presents all index consequently. On the other side, “Tell Put Pointer” and
file’s related visual blocks, and the first one in the serial is an “Tell Get Pointer” blocks return “Get “and “Put” pointer
“Open File” block made of two inputs and one drop-down indexes. BBVPL also competence to deal with special
field. The placeholder “1” is representing the file descriptor, characters, for instance, backspaces, new line, tab, and end of
and its value should be unique, while the placeholder “File the line. Table 3 is screening “Files” related blocks discussed
Name” represents the file name. The right drop-down field earlier.
represents file mode, which is already filled with different file
creation modes like r, r +, w, w+, a, a+, etc.
1 Open File
2 Close File
3 Write Line
4 Read Char
5 Read Line
Figure 13: File’s related visual program’s textual code
6 Seek Put Pointer
Figure 12 is viewing a sample visual program in which
7 Seek Get Pointer the “File Open” block opens a file named as “file1” in “w+”
mode. The “Seek Put Pointer” is setting the “Put” pointer to 0th
8 Tell Put Pointer index and a loop iterates three times, takes an input string and
\
writes inputted contents into “file1”. The next block
9 Tell Get Pointer
instructions print “Put” and “Get” pointing indexes. “Read-
10 Back Space Line” block is reading the file’s character until the end of the
line (\n) character. The textual executable JavaScript code is
11 New Line representing in Figure 13. Finally, the file closed using the
“Close File” icon.
12 Tab
13 End of File 6 CONCLUSION AND FUTURE WORK
A lot of Visual Programming Languages (VPLs) have
been developed for learning and educational purposes and the
rest for games and robotic applications development. The
existing VPLs lack many fundamental programming
capabilities. Teaching programming fundamentals, requires to
use a language either a VPL or TPL that can manage arrays or
lists creation, modular support, exceptions, file handling,
conditions, loops, multithreading, object-orientation, and
debugging support. In this paper, a Block-based Visual
Programming Language (BBVPL) has been proposed and
implemented, based on Google’s Blockly Library that
provides a visual drag-drop programming environment to
teach basic programming concepts. BBVPL helps to learn
vital programming skills, which were discussed earlier. In the
future, it will also provide single-step program execution
(debugging) and multithreading facilities as well. The user’s
Figure 12: File’s related BBVPL’s sample program roles and rights management will be part of BBVPL in the
future.
The second block in Table 3 is “Close File” closes related
file by putting file descriptor number in the provided APPENDIX
placeholder. “Write Line” block to write characters, variables
and string values to the desired file. For file reading purposes, Appendix A tabulates the Visual Icons/Features already
BBVPL provides a single character reader and line by line available in Blockly.
file’s content reading ability using its “Read Char” and “Read
Line” blocks accordingly. “Seek Put Pointer” and “Seek Get
Pointer” blocks to demand an integer value to set the pointing
2530
Ashfaq Ahmad et al., International Journal of Advanced Trends in Computer Science and Engineering, 10(3), May - June 2021, 2524 – 2532
2531
Ashfaq Ahmad et al., International Journal of Advanced Trends in Computer Science and Engineering, 10(3), May - June 2021, 2524 – 2532
21. E. Perrin, S. Linck, and F. Danesi, “Algopath: A new 37. G. Cooper, “Using Visual Logic with Pseudocode to
way of learning algorithmic,” 2012. Teach an Introductory Programming Course,”
22. W. Q. Burke, Coding & composition: Youth storytelling proceedings of WorldComp 2014, 2014.
with Scratch programming. University of Pennsylvania, 38. “Visual Logic.” Accessed: Jul. 28, 2021. [Online].
2012. Available: https://www.visuallogic.org/
23. “Microsoft Word - LarpEnV3x.doc”, Accessed: Aug. 39. G. Shobaki, “Computer Science Colloquium Series
06, 2018. [Online]. Available: since 1997 Topics, Speakers, and Abstracts during
http://www.marcolavoie.ca/larp/en/default.html 2010-2015,” 2015.
24. J. Maloney, M. Resnick, N. Rusk, B. Silverman, and E. 40. “Flowgorithm Flowchart Programming Language.”
Eastmond, “The scratch programming language and http://www.flowgorithm.org/ (accessed Jul. 28, 2021).
environment,” ACM Transactions on Computing 41. N. Fraser, “Ten things we’ve learned from Blockly,”
Education (TOCE), vol. 10, no. 4, p. 16, 2010. in Blocks and Beyond Workshop (Blocks and Beyond),
25. N. Zamin, H. Ab Rahim, K. S. Savita, E. Bhattacharyya, 2015 IEEE, 2015, pp. 49–50.
M. Zaffar, and S. N. KatijahMohd Jamil, “Learning 42. “Introduction to Blockly.”
Block Programming using Scratch among School https://developers.google.com/blockly/guides/overview
Children in Malaysia and Australia: An Exploratory (accessed Jul. 28, 2021).
Study,” 2018 4th International Conference on 43. wikipedia.org, “Console Apllication.” Accessed: Jul.
Computer and Information Sciences: Revolutionising 28, 2021. [Online]. Available:
Digital Landscape for Sustainable Smart Society, https://en.wikipedia.org/wiki/Console_application
ICCOINS 2018 - Proceedings, Oct. 2018, doi: 44. Wikipedia.org, “Struct (C programming language).”
10.1109/ICCOINS.2018.8510586. Accessed: Jul. 27, 2021. [Online]. Available:
26. A. Repenning, “Agentsheets: a tool for building https://en.wikipedia.org/wiki/Struct_(C_programming_
domain-oriented visual programming language)
environments,” in Proceedings of the INTERACT’93 45. G. Kiczaleset al., “Aspect-oriented programming,” in
and CHI’93 conference on Human factors in computing European conference on object-oriented programming,
systems, 1993, pp. 142–143. 1997, pp. 220–242.
27. Scratch Wiki, “Scratch.” https://en.scratch- 46. B. H. Liskov and A. Snyder, “Exception handling in
wiki.info/wiki/Scratch (accessed Sep. 06, 2018). CLU,” IEEE transactions on software engineering, no.
28. Y. Chen, Z. Du, and M. Garc\’\ia-Acosta, “Robot as a 6, pp. 546–558, 1979.
service in cloud computing,” in Service Oriented 47. Wikipedia.org, “Exception handling.” Accessed: Jul.
System Engineering (SOSE), 2010 Fifth IEEE 27, 2021. [Online]. Available:
International Symposium on, 2010, pp. 151–158. https://en.wikipedia.org/wiki/Exception_handling
29. “VPL Introduction Microsoft Docs.” Accessed: Sep. 48. “File Handling in C language with inbuilt functions.”
22, 2018. [Online]. Available: https://fresh2refresh.com/cprogramming/ c-file-
https://docs.microsoft.com/en-us/previousversions/ handling/ (accessed Jul. 27, 2021).
microsoft-robotics/bb483088(v=msdn.10)
30. S. Dekhane and X. Xu, “Engaging students in
computing using GameSalad: a pilot study,” Journal
of Computing Sciences in Colleges, vol. 28, no. 2, pp.
117–123, 2012.
31. “Gamesalad gears up for iphone publishing system.”
Accessed: Aug. 22, 2018. [Online]. Available:
http://www.austinstartup.com/2009/09/gamesalad-
gears-up-for-iphone-publishing-system/
32. J. Liu et al., “Making games a snap with Stencyl: a
summer computing workshop for K-12 teachers,” in
Proceedings of the 45th ACM technical symposium on
Computer science education, 2014, pp. 169–174.
33. wikipedia.org, “Stencyl.” Accessed: Jul. 28, 2021.
[Online]. Available:
https://en.wikipedia.org/wiki/Stencyl
34. “Stencyl: Make iPhone, iPad, Andoid, Windows,
Mac, Flash and Html5 games without code.”
Accessed: Jul. 15, 2018. [Online]. Available:
http://www.stencyl.com/features/
35. “About EV3- Mindstsrms LEGO.com.” Accessed:
Jul. 15, 2018. [Online]. Available:
https://www.lego.com/en-us/mindstorms
36. J. G. P. Francisco, A. M. Rees, J. Hughes, J. Vermeersch,
I. Jormanainen, and T. Toivonen, “A survey of
resources for introducing coding into schools,” ACM
International Conference Proceeding Series, vol. 02-04-
November-2016, pp. 19–26, Nov. 2016, doi:
10.1145/3012430.3012491.
2532