Both Blockly and Python have advantages and disadvantages relative to each other. From the point of view of students, we could summarize these as follows:
- Relatively easier than Python for students to learn.
- Does not require really good typing skills
- Can be used down to Lower Middle School, (and below with capable students).
- Good for quick prototyping to see if a student project using a Fusion robot is feasible.
- Inefficient in terms of the use of the Fusion’s Raspberry Pi computer.
- Does not have easy access to pre-written libraries for use in advanced (pre-University & University) projects using Fusion.
- Relatively efficient in terms of the use of the Fusion’s Raspberry Pi computer.
- Has access to pre-written libraries for use in advanced (pre-University & University) projects using Fusion
- A comparatively good text-based coding language for Upper Middle School and pre-University students
- Arguably easier for school students to learn than competing languages (e.g. Java, C, C++)
- Requires students to have reasonably good typing skills
- Much more difficult for students to debug (remove code errors) that is the case with Blockly.
If you have suddenly decided that Blockly suits your needs better than Python, you can go to our Blockly course for Fusion Beginners by clicking here.
If you are “keeping the faith” with Python, we will now look at the Python code automatically produced by the Blockly program we used to teach our brave Robot to “Approach An Alien” in the previous tutorial.
As shown above, the “Approaching An Alien” Blockly code had 7 blocks, and the Python code produced automatically by this code had 18 useful lines. When this code was “cleaned up”, the Python code was reduced to 12 lines (11 useful) – a reduction of 39%. The video below shows how this reduction was achieved.
This is a tiny program, and the reduction in running time would be hardly noticeable. However for large programs, the difference can be very significant. Many Engineers who have very tight deadlines for producing preliminary results, often start by looking at quick rough options like Blockly, and then transition to more efficient methods like Python when the project’s final research/production direction has been decided, and efficient programs for use in Business are required. Which approach you need for your project is a decision that you are probably in the best position to make.