Blockly: Using Block Based Coding in your App

Blockly: Using Block Based Coding in your App


CORY DIERS: Hi. I’m Cory Diers and I’m a
software engineer at Google. I work on a developer
library called Blockly, which makes it easy
to build block programming experiences. In this video, we’ll
cover what Blockly is and how to use it in your app. Blockly includes all
the pieces needed for defining and rendering
blocks in a drag and drop editor. Each block represents
a bit of code that a user can easily snap
together like puzzle pieces. Typically, the
Blockly UI includes a workspace, where users
assemble their code, and a toolbox, where
they can get new blocks. The library then generates
syntactically correct code in the language of your choice. Blocks are a fun way for
users to interact with code. Blockly can be used
with physical devices, like robotics, toys,
or home automation, or entirely digital
applications, like animation, teaching programming,
or even video games. Anything you can code with
text, you can code with blocks. But Blockly itself
isn’t a language. The code generated
by the blocks still needs to be run somewhere. For that, there are
several options. Blockly includes generators for
JavaScript, Lua, Python, Dart, or PHP. So anything that can be run
on one of these languages can run the generated code. Developers have also
created their own generators for other languages, including
some non-programming languages, like legal documents
or music notation. So now that you have an
idea of what Blockly is, we’ll talk a bit more
about how to use it. The basic steps are– add the library to your
app; design your blocks and write code generators
for them; test and iterate. Blockly has libraries
for web, iOS and Android, so you can add it to your
app, no matter which platform you’re targeting. Check the description for
links to the developer docs. They include in-depth set-up
instructions for each platform. Once you’ve got the
demo blocks working, it’s time to build some
blocks of your own. The Blockly Developer
Tools provides a UI for creating and
trying out blocks. If you prefer, blocks can
also be defined in JSON. Be sure to consider
your audience carefully when designing your blocks. For example, a block that
reads “repeat five times” may be more understandable
for a novice than a block that reads “for int i equals 0,
i less than 5, i plus plus.” The Developer Tools
can also define which blocks are
shown in the toolbox and can be used for
quick prototypes. Speaking of prototypes, don’t
forget about user testing. If you’ve designed your
blocks in the Developer Tools, you can try out the
look and feel or even print them to use in
a paper prototype. It’s always hard to know when
users will run into trouble. So testing blocks out early is
critical to a successful app. You can even start testing
before you’ve written any code. There’s a lot more that can
be done with Blockly than we have time for it in this video. If you’d like to
learn more, check out the links in the description or
subscribe to our mailing list, [email protected] Thanks for watching. [MUSIC PLAYING]

15 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *