What is Block-Based Coding?

stem-t4l--PnSpCHYKsw-unsplash.jpg

Block based coding involves dragging and dropping pre-made blocks of code from a list into your coding environment. These blocks are placed in the coding environment by the programmer, where they are able to connect the blocks in a certain order. These blocks then act as a script, and they instruct characters or backgrounds to do certain things. Block based coding is the perfect way to introduce kids to coding.

An example of the blocks available in the Scratch programming language

An example of the blocks available in the Scratch programming language

What is a “block”?

Blocks are essentially little packets of code. Each block is an instruction which can be slightly modified by the programmer in order to get something done. For example, in Scratch you have 7 main different types of blocks - these are looks, sound, events, control, sensing, operators and variables. Looks and sounds blocks are pretty much what you’d expects - they allow you to alter the character’s (in Scratch, known as Sprites) appearance and play music or sounds in the background. Events allow you to trigger a line of code when an event happens - for example “when the space bar is clicked, this sprite goes to this position on the screen”. Control introduces something a little bit more complicated - loops! Used in conjunction with sensing blocks, programmers can do some pretty cool stuff - for example, “if the Sprite touches a different Sprite, that’s game over”. Operators and variables can be used for a variety of things, including counting a players score if you’re making a game, or comparing two numbers.

What are some examples of block based coding?

There are so many block based programming languages out there - probably because they’re such a fun and easy way to get into programming from a young age! If you’re interested in learning one yourself, here are some of our favourites:

  1. Scratch

    Scratch is probably one of the best coding languages for beginners out there. It introduces young programmers to concepts such as loops and if statements in a fun, colourful way. Code is used to animate characters called “Sprites”. Although it seems simple, you’d be surprised at how powerful a language it is.

  2. Blockly

    Blocky is a block based coding language created by Google. It looks similar to Scratch, and can be used to compile code in a few different languages including JavaScript, Python and PHP.

  3. Visual Logic

    Visual logic is a little different from the other two languages - instead of using blocks which connect to make a full script of code, visual logic uses the concept of flow diagrams to teach programming to students.

Why learn block based coding?

An example of one of the games you can make on our Beginners Scratch Course

An example of one of the games you can make on our Beginners Scratch Course

There are so many reasons to learn a block based coding language. If you’re new to coding and find the thought of writing hundreds of lines of code intimidating, learning a block language would be perfect for you! It teaches you how to control the flow of your program and demonstrates what you can do with a few lines of code. They’re the perfect stepping stone to learning text based coding languages like Python, C# or JavaScript. Block based coding initially seems a bit futile - how can it possibly be as powerful as a text based language, when all you have to do is drag a few blocks around? This is a fair enough question to ask - I thought the same thing when I first learnt Scratch, but I’ve been amazed at the multitude of things you can do with it. From creating incredible versions of classic games like Flappy Bird and Space Invaders to writing a machine learning algorithm, block languages like Scratch enable the inexperienced programmer to make some pretty advanced programs in not much time at all.

Where can I learn more?

Here at Educademy, we teach a variety of block-based coding languages. If your child is enthusiastic about programming but doesn’t know where to start, why not check out our beginner’s Scratch course (if you’re not ready to commit, you can also book a free trial). For those with a little more experience, check out our intermediate Scratch course (or try the free trial). And for those interested in the wonders of Artificial Intelligence, check our our AI/ML course in Scratch.

Author: Richa Lad