Python vs Javascript vs Blocks

At the beginning of our project we referred to our ArtBots as being “python powered”.  However, our team has decided to switch from using the python in the mu editor to using a combination of blocks and javascript in the MakeCode editor.

Here’s why:

  •  Some of our group members are interested in programming and designing for web. Javascript is a language commonly used in web development and our team saw this as an opportunity to allow those group members to develop some experience using a language that they would like to gain more fluency in. 
  • For the group members who are not interested in web development, learning other programming languages is still important. For example, I collect job postings that sound interesting to me and this was one of the job requirements in a posting, “Fluency in a handful of languages such as C++, Python, Javascript, etc”.  Clearly it’s beneficial to be familiar with a variety of languages and this project is a good opportunity to develop some of that familiarity.
    • We think that MakeCode in particular is a good way to learn Javascript because of the ability to toggle between blocks and text. You can make sure that the structure of your code will work by using blocks and then tinker with the text. Additionally, if you are familiar with the blocks and their capabilities as I am, the way that the blocks are translated to javascript is incredibly helpful for learning the syntax of javascript. Because I know what the blocks do, I can easily associate the new syntax. I don’t have to learn function and syntax at the same time as beginner programmers often have to do. 
  • Our group is interested in exploring the capabilities of communication between micro:bits/gigglebots and a PhD student at the ATLAS Institute, Annie Kelly, has developed a proximity package for the MakeCode environment that facilitates this exploration. We wanted to be able to experiment with the package she created which further contributed to our decision to use MakeCode.

Here’s how I began the process of tinkering with blocks and Javascript in MakeCode:

First I put together some code using blocks that I knew would work and that I clearly understood.

Next I toggled to the Javascript mode and began to break down and understand the syntax. It looks very similar to python coding that we’ve done in other assignments. 

I started  by simply practicing typing out the javascript. I deleted the code and tried recreating it from memory. It was difficult to remember what the syntax was for a lot of the code but the function in MakeCode where a menu of items pops up below what you’re typing made that easier. As I recreated the code I tried changing a few simple items like the amount of time the gigglebot would drive forward and how many times the loop was repeating. 

Finally, I toggled back over to the blocks mode to make sure that the code I typed was correct. I noticed that you can use this as a proofreading tool. If you’ve coded something incorrectly in Javascript it won’t let you toggle back over to the blocks. 

After these simple experiments with MakeCode blocks and javascript I’m still wondering how more advanced programmers might use the two. Do they prefer to use javascript? Can blocks be used as a sketching tool where you lay out the rough shape of your program and then you use javascript to fill in the details? Or vice versa? 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.