What is code analysis?
As a senior Scratcher, do you know how much you’ve improved since your first project?
As a novice Scratcher, how to find out the difference between you and griffpatch without spending several hours reading through his code?
To meet these needs, we developed a code analysis bot which runs in our discord server.
Here is an analysis report for one of griffpatch’s projects.
You can use this analysis tool to assess your improvement from project to project and compare your code with experienced Scratchers’. It is super easy to access.
Just join the discord server, and search for the ‘code-analysis’ channel.
Type ‘/’ in the chat bar. You will find the command ‘/analyse’. Select it.
Then, copy and paste your Scratch project link. Press enter.
You will get a brief report in the channel, and the Gandi bot will send you a full report via DM.
How does the code analysis bot work?
The report is generated based on the count of blocks. Here is the explanation of each section.
This section lists some basic data about the project.
The number of sprites in this project. Not including the stage.
The number of code blocks in this project. Not including variable and list reporter blocks.
The number of My Blocks in this project.
The number of costumes in this project. Including costumes of the stage.
Shows the basic distribution of blocks on a spectrum. The more motion, appearance, or sound blocks are in this project, the farther the pointer will be to the right.
Referring to Analyze your Scratch projects with Dr. Scratch and assess your Computational Thinking skills, the project grade is calculated based on the table.
The conversion between scores and stars is：
This section classifies all the blocks by category, visualized in different colors.
This section includes some detailed analysis, which is explained in the text, and two diagrams.
Math and Algorithm
All math expressions are classified into three categories.
- Arithmetic expressions:
- Logical expressions:
- Math functions:
(All functions in the menu)
The diagram shows how many blocks are in each of these three categories.
This diagram assesses all blocks along two axes.
- Computational concepts (x-axis): the concepts developers use when working with a block, assessed from basic to advanced.
- Function(y-axis): assesses whether the main use of a block is for appearance or for algorithm building.
You can see how blocks are distributed in these two dimensions.
Behind the report
Referring to New frameworks for studying and assessing the development of computational thinking, a paper from MIT Media Lab, there are three key dimensions to assess the development of computational thinking in interactive media design.
- Computational concepts: the concepts designers engage with as they program, such as iteration, parallelism, etc.
- Computational practices: the practices designers develop as they engage with the concepts, such as debugging projects or remixing others’ work.
- Computational perspectives: the perspectives designers form about the world around them and about themselves.
The paper describes by authors’ evolving approach to assessing these dimensions, including through project portfolio analysis, artifact-based interviews, and design scenarios.
Our code analysis bot was developed with reference to project portfolio analysis.
In their research, the authors compared the analysis results of two Scratchers.
This is the visualization result for an experienced Scratcher.
This is the result for a novice Scratcher.
Each column represents a project and all of the blocks it contains, while each row represents a specific type of Scratch block. A darker shade indicates a more frequent use of a block within the project. The final column identifies blocks that have never been used.
The difference between the two Scratchers is clear to see.
Analyzing a project’s blocks provides a record of computational concepts that are have been encountered by a Scratcher.