+5 votes
221 views
in Web development by (242k points)
reopened
What is Blockly?

1 Answer

+3 votes
by (1.6m points)
edited
 
Best answer

What can Blockly be used for?
What functions can be used with Blockly?
Blockly example
In what areas is Blockly used?
In short: a good alternative to complex programming languages

image

What is Blockly?

If you want to program a website that reacts to user input, you will have no choice but to deal with programming languages. Even if you develop an application, you will generally need to work with a high-level programming language . Although today there are adequate resources for learning how to use Python, JavaScript, and others, internalizing complex commands and routines requires considerable effort. Also, when all you want is to take your first steps with programming or you just need specific directives, resources are often excessive..

This is where Blockly proves its usefulness: Blockly is a Google project that displays long snippets of text-based code in visual blocks. These blocks can be attached by dragging and dropping. In this way, complex syntax can be created quickly and easily. Blockly is a library that provides a visual code editor , so the syntax of programs created in this way remains in the background. Blockly allows you to easily create complex sequences, without having to know exactly what command is required in each programming language.

Index
  1. What can Blockly be used for?
  2. What functions can be used with Blockly?
  3. Blockly example
  4. In what areas is Blockly used?
  5. In short: a good alternative to complex programming languages

What can Blockly be used for?

Blockly can be used for a number of reasons. For example, if you want to create a website that is responsive to users, but you don't have great programming skills , you can use this library. However, even more seasoned software developers can use this visual code editor to create small programs quickly..

In addition, its playful approach allows you to quickly understand relationships when programming. It is easier to understand the phrase? Repeat 5 times? that? for int i = 0, i <5, i ++;?, even though they both mean the same thing. This is why Blockly is often used in pedagogical settings. Blockly is a good choice for children who want to program their first software. The visual representation of the code snippets allows you to obtain amazing results quickly and easily.

Its visual interface makes the code clear and easy to understand. Like the pieces of a puzzle, the blocks fit together and can be converted to code. Although Blockly is a JavaScript library, it allows you to produce source code in a variety of languages ​​by default, including JavaScript, Python, PHP, Lua, Dart, and XML. The editor can be easily used in a browser..

Visual programming is no longer something new. In fact, many providers already use it to create web pages. These easy-to-use web page builder programs, like the one at hand, have a simple and intuitive interface. The written code is kept completely in the background, so even the inexperienced can get amazing results.

Note

Blockly is very similar to Scratch. However, while Blockly is more geared towards professional developers in a business context, Scratch was conceived primarily as a pedagogical medium.

What functions can be used with Blockly?

Eight categories with different functions are offered in Blockly's visual code editor:

  • Logic describes actions.
  • Loops are control structures and are repeated until a certain action occurs.
  • Math is used to perform various arithmetic operations and generate random numbers.
  • Text can access inputs and generate individual outputs.
  • Lists is a function for generating lists in combination with text or math blocks.
  • Color is used to apply color to the text or the background.
  • Variables is for calculations or functions.
  • Functions describe the behavior of the page when a certain input is detected.

The blocks allow different combination possibilities . Loops and functions can be combined with logic and variables. Logic and variables, in turn, can be combined with math, text, lists, and color. With just these combinations, many of the fundamentals of the various programming languages ​​can be covered.

Blockly example

Learning to work with Blockly is very simple: open a category and drag the desired code block with the mouse to the workspace . There you can adjust individual blocks and link them to others. If a combination is not possible, the block will not fit and will not be included in the source code. Each individual piece or group of puzzle blocks can be erased again from the work area without problem. The corresponding lines will also be removed from the source code.

For example, if you want to connect a popup to a counter, you can do it like this:

via GIPHY

This simple code can be translated into different programming languages. In JavaScript, the source code would look like this:

  var int; Int = 1; while (int <= 3) { window.alert('Hello, World!'); Int = int + 1; }  

Of course, this is just a very primitive code example. However, teach the computer to say? Hello world !? it is always the first lesson when learning a programming language.

In what areas is Blockly used?

While the application is primarily aimed at students and newcomers, the library itself is geared towards developers : with very little effort, developers can create their own function blocks and logic to turn the library into a standalone application.

If you want to develop your own blocks within Blockly, you have two options: on the one hand, you have the JavaScript API , which is used mainly for web applications. On the other hand, there is a JSON interface that also works with Android and iOS. However, in the JSON format only the most used blocks can be chosen. A very extensive documentation can be consulted on GitHub. In addition, Google provides detailed guidelines for the use and development of Blockly.

YouTube, Stack Overflow, and GitHub contain countless tutorials and documentation on how to use the library effectively. Among its many possibilities, various switches and receivers can be programmed to control smart homes. As the program allows you to connect several languages, your imagination will have no limit.

In short: a good alternative to complex programming languages

For beginners, it is especially attractive that the program always writes with the correct syntax and never forgets a semicolon or quotation marks. Its playful way of use makes it easier to work on projects, even as a beginner, and thus gain experience. With it you will quickly learn the possibilities of language and will be able to instinctively design prototypes and models .

Blockly is still simple, but it can greatly streamline your workflow. Its library can be easily integrated into existing projects, making it even easier to develop large projects. However, it is important to become familiar with the functions. The source code created with Blockly can be incorporated into a large number of projects, thanks to the large number of languages ​​with which it is compatible. This is why this open source solution is a useful tool for many people besides students.


...