-
Notifications
You must be signed in to change notification settings - Fork 3
Why program with GlowScript Blocks?
Programming with blocks has some advantages and some disadvantages, which are listed below. The blocks are designed to teach a beginner about some fundamental concepts that are used when giving commands to a computer. We connected the blocks with GlowScript so that the beginner can see direct, intuitive feedback about whether their program is working properly. The blocks were not designed for someone to use forever; they are meant to meet a temporary developmental need for beginning programmers and to be replaced with code when the programmer is ready. We truly believe that these blocks will be helpful and fun!
- Blocks have color
GlowScript Blocks are colored according to the type of data that each block outputs. Vector, number, shape, text etc. blocks are colored differently to help the programmer understand better what they are building and anticipate what type of data will be generated by the blocks. Some text-based development environments use color for keywords in a language, but the color doesn't help you keep track of data types.
- Blocks that result in invalid code won't connect
When code is invalid, errors result. This can be frustrating, especially for the new programmer. The blocks have been designed so that blocks don't go together if they shouldn't. This is a way of giving more immediate feedback to the programmer that a mistake is being made. In the picture example, the attribute pos
needs a vector input, not a number, so the number block will not connect.
- Blocks are organized
When a program is built with blocks, it has a neat and organized look. It can be easy to spot from a distance where certain things like declaring variables and repeating loops are happening, once the colors are learned. It builds the expectation for the programmer that a typed program should be organized and easy to interpret by eye.
- Available blocks are displayed on a menu
It can be hard to learn what a programming language can do. With blocks, the available commands are listed in the menu on the left, so the beginner can browse around and try things.
Can you imagine going to a restaurant where there were no menus? Or trying to learn to cook without a cookbook? It can be hard to have ideas when you don't know the possibilities. Programming languages do have documentation that learners can consult, but sometimes the documentation is hard to learn from.
- Syntax is built in to the blocks
Blocks often are labeled with everyday language that is more familiar than formal syntax is. Blocks tell the programmer what types of data it "wants" as input, and how many inputs it wants. Blocks that output data tell you with their colors what type of data they output.
- Blocks are easily duplicated and then edited
Right-clicking (Windows) or Ctrl+clicking (Mac) a block allows you to duplicate an existing block so that you can edit it and create a combination of blocks that is almost the same as what you have already built. There are other options as well (like adding comments to code) in the menu that drops down.
- Blocks tell you what variables you already have
When you want to refer to variables that you have already created in your program, you can select the drop down menu in a "Variables" block, and you will see a list of all the variables.
Two common errors by beginning programmers - (1) mistyping the name of a variable and (2) referring to a variable that does not yet exist - can be easily avoided by choosing existing variables from the drop-down menu.
- ">_View Code" helps you learn the code
Click the ">_View Code" button and see the code that is generated by the blocks. You can even select an individual block, and the specific piece of code that it generates will be highlighted!
- Dragging and dropping can grow tedious
It can be tiring to do a lot of intense logical thinking while also trying to coordinate fairly complex clicking and dragging. Sometimes when programming with blocks, you might think "Why wouldn't I just type this with code?" In that case, you might have learned enough code that you should consider moving on to direct editing of code.
- Some block tasks take longer than typing
Math blocks in particular can take a lot longer to assemble than the equivalent code can be typed, if the programmer is familiar with the syntax. For example, something like F = G * m_1 * m_2 / r**2
or t = t + dt
is much easier and faster to type than it is to build with blocks, for most programmers.
- Sometimes the blocks don't behave as you would expect
Because the blocks are designed to guide your assembly of them, sometimes they change form when you think they shouldn't. This can be surprising and frustrating at first. If there is any persistent annoying behavior of the blocks, and which you find hard to get used to, we want to know about it so that we can consider redesigning any details of how they work. We want the blocks to be fun for beginners.
- Block programs don't have empty lines or line numbers
Inserting empty lines into a typed code program can help to create visual space between pieces of code that go together in some common theme. Line numbers help programmers talk to each other about where their attention is.
- The blocks don't cover all the possibilities
Many commands that are available in the GlowScript language are not supported by GlowScript Blocks. The development team strived to design the blocks so that they would cover all of the uses that most beginning GlowScript programmers would need. As programmers become more experienced, it is expected that they will move on from the blocks to typing GlowScript code.