Programming languages for web and desktop applications have the reputation of being difficult to learn. Anyone who grapples somewhat more intensively with this subject will quickly observe that there is a lot of truth to this – as most people make use of traditional languages such as C++, C#, or Java only after intensive studies and regular practical application. Scratch shows, however, that it definitely gets easier. Anyone who wants to learn programmingunder simplified conditions receives the appropriate solution with this open-source language platform. What exactly this programming project, primarily geared toward children, is about and how programming with Scratch works, you will learn in this Scratch tutorial.
- What is the Scratch Project?
- What is unique about programming with Scratch?
- Scratch tutorial: learn to program with Scratch
- Learn Scratch: the user interface checklist
- Understanding the Scratch Editor: this is how Scratch coding works
- Programming with Scratch: a simple project example
- Publish your own Scratch coding project
What is the Scratch Project?
Scratch is supposed to make the basic principles of programming more tangible and comprehensible for newcomers – for children and young people, especially. Scratch has managed to do this without making all the elements that require intuitive familiarisation difficult. Components that are considered conducive to learningand motivation have been strongly weighted. Finished projects can be made public on the Scratch platform and shared with the rest of the community. Scratch is about playful learning – a top priority when it comes to programming for children.
Scratch is used worldwide in more than 150 countries, where the project or interface and numerous tutorials are available in more than 40 languages. Regardless of whether the learning of Scratch takes place as part of school lessons or privately at home, it is always free.
What is unique about programming with Scratch?
Scratch is based on a graphic user interface that makes complicated language syntax or general code-typing redundant. First and foremost is the desire to help provide newcomers with their first programming experience. This is why the aspect of easy usability always takes priority over having a variety of functions. Despite these constraints, however, Scratch has some of the important properties of traditional programming paradigms, as the following list shows. They are:
- visual: All Scratch elements are represented through a comprehensible, graphic representation – program commands via image blocks, for example. In addition, they can be conveniently inserted and put together via drag-and-drop.
- object-oriented: With Scratch programming, there are neither classes nor an inheritance system. With items such as data encapsulation (controlled access to data via defined interfaces) or polymorphism (objects can assume different data types), however, Scratch demonstrates characteristics of the object-oriented programming concept.
- imperative: Some of the scripts that are made available to you for programming with Scratch follow the imperative programming paradigm. Instruction sequences, thus, specify in which sequence which actions should be executed.
- event-oriented: Every script that you use in a Scratch project starts as soon as the event defined in its header block occurs. Through the use of a “Wait Until” block, the loading of a project can also be delayed until the occurrence of a specific event.
- parallelism-supporting: The distribution of computer programs in individual sub-components that distinguish the principle of parallel programming is supported in Scratch from the outset.
Scratch tutorial: learn to program with Scratch
The saying “practice makes perfect” applies to Scratch coding too. Though the programming project offers entry hurdles that are clearly lower than classic programming languages, it does still require a certain amount of time to familiarise oneself with and internalise the user interface and available blocks. In the following Scratch tutorial, we show you how you can register on the platform in order to then introduce all important components of the user interface. To conclude, we explain programming with Scratch using a specific project example.
If you want children to familiarise themselves with Scratch programming, you should grapple with the open-source platform beforehand. The better you understand the language and its user interface, the more you will be able to help children during these initial steps.
In order to start a Scratch project, it is generally not requiredthat you set up an account. You can also simply access the Scratch platform by launching the browser of your choice and clicking the “Start Creating” button. In order to join the large Scratch community and to be able to share videos, games, etc. with other users upon completion, however, you will need a user account. This is why it makes sense to register.
In order to create a user account, click on the “Join Scratch” button and enter your desired username and a secure password in the subsequent menu:
After clicking on “Next,” you will need to specify some personal information such as your country of origin or birthdate. In the last step, in order to conclude registration, you will need to specify a valid email address and click on “Set Up Your Account.”
You are then automatically registered. In your inbox, you will also find a link through which you can activate features for publishing and commenting on programmed Scratch projects.
If you want to use Scratch for teaching purposes, you have the option of applying for a teacher user account. This special account type enables you to set up classes and to create and administer individualstudent accounts. The Scratch team reviews teacher account applications manually, which takes up to 24 hours.
Learn Scratch: the user interface checklist
If you set up a user account and have logged into your profile, you have a number of different options available that can be selected via the upper menu bar.
When you click on the Account button, you can manage your personal profile, change your location settings, password, and email address, or bring up the overview of active projects (“My Stuff”). Furthermore, you can log out here as well:
Hidden behind other available menu items are the following features:
- Develop: The central component of the Scratch web project is the graphic development environment, which you launch via the “Development” tab. With the help of this web editor, you program all of your Scratch applications directly into the browser.
- Explore: In this category, you can call up the projects of other users. In doing so you cannot only playback but also view all of the Scratch programming. Projects of a similar type are combined in a “Studio.”
- Ideas: The “Ideas” section grants you access to different tutorials and guides, which assist you with developing your own projects – in particular when it comes to brainstorming. You will also find a redirect link for downloading the Scratch app (Windows 10, macOS, ChromeOS, Android) here, which enables you to program without an active Internet connection.
- About Scratch: If you call up the “About Scratch” menu item, you’ll be directed to a general information page about the Scratch project. Among other things, you will find links for supporting information material for parents and teachers, as well as tips and a FAQ section.
Understanding the Scratch Editor: this is how Scratch coding works
The Scratch development environment is reminiscent of a homepage building block, which, given the block-nature of the available script isn’t so surprising. In addition to these scripts, which make up the majority of the usable components, you can also add costumes and sounds to a project that you can then manage or implement via script. By clicking on “Add Extension” the selection of scripts can be enlarged – for example, with a crayon, code for video recording, or a text-to-speech feature.
Scratch provides you with a variety of costumes, sounds, and scripts that you can immediately integrate into your projects. Alternatively, you can also import or record your own images or sounds should you not find the appropriate element in the available material. You can also generate your own scripts.
Costumes: Bring figures and objects to life
Whatever you would like to program with Scratch – a game, video or animation, or maybe even a simple comic: figures and other objects are the central building blocks for your story. Under the “Costumes” tab you can select and integrate any number of graphics into your project. Choose from the available image options, draw objects by hand, or import locally-stored graphics. You also have the option of taking a photo as long as your device has a camera.
If you have selected a costume, you can then customise it. To do this, select the desired object in the left-side menu (where you can delete it at any time by clicking on the Recycle Bin icon) and then use the available editor tools to, for example, change colours, remove specific details with an eraser, add text or warp the object. A conversion of the graphic into a raster or vector graphic is also possible. In the “Costume” field you also define the name of the costume, which the respective scripts later require as reference values.
On the right lower margin of the window, you will find the “Choose a Backdrop” button. With this option, you determine your project’s background image. Scratch provides a selection of stock images or you can import your own images, or even paint your own background graphic.
Sounds and background music
For many creative projects, the appropriate soundtrack is just as essential as objects and figures. When programming with Scratch, you implement and manage all sounds via the menu of the same name. As with the graphic elements you, on the one hand, have a selection of pre-created Scratch sounds available to you for this purpose, that you can access via “Choose Sound”. On the other hand, the option exists for importing or recording sounds, provided that you have connected a microphone.
Inserted sounds can be selected in the left-side menu by clicking on the corresponding thumbnail and then edited in diverse ways. Among other things, you can, for example, cut out selected sequences, adjust the volume,or increase or reduce the playing speed. Because sounds are integrated into the Scratch project with the use of scripts, each sound also requires a unique name that you assign in the “Sound” field.
Scripts: the essence of Scratch coding
In order to successfully program with Scratch, it is necessary to practice handling the Scratch scripts. The actual code behind these scripts is automatically generated as soon as you drag the available blocks into your project – regardless of whether it’s an event, function, operator or a variable. As a user, you can focus on inserting the respective scripts with individual values and the respective graphic and sound components.
For all pre-created scripts, there are precise descriptions that show the functions they have. If you want to implement a script in your project, simply drag the respective block – as the script building models are referred to in Scratch – into the middle editor window. Values or options to be defined can be viewed directly on the block and can also be directly typed or selected there. Should such a new script directly refer to an already inserted script, then simply attach the corresponding block as you would if you were putting together a puzzle.
The difficulty in learning Scratch does not lie in having to internalise syntactic rules or a recording format, but instead in understanding the function of the separate scripts in order to optimally implement them and combine them with each other.
Programming with Scratch: a simple project example
Since the preceding section of this Scratch tutorial introduced the most important components of this programming platform, Scratch’s possibilities should finally be demonstrated using a specific example.
In the first step, we are looking for a backdrop for our project by moving the mouse over the backdrop icon at the lower edge of the screen and clicking on “Choose Backdrop”. We have chosen the “Blue Sky” theme, which we adopt without any changes:
Next, we insert a figure into the project example. Because the “Backdrops” tab can currently be seen instead of the “Costume” tab, we click on the “Choose Figure” button on the bottom right. In the Scratch selection, there are diverse figures with several costumes with which motion sequences can later be simulated. The “Cat” figure, for example, is available in the versions “cat a” and “cat b”, which played back consecutively creates the impression that the cat is walking
Custom versions for a figure make it easier for a motion sequence to be programmed with Scratch.
In the last step of this short example, we want to get to the main point, which is programming with Scratch and making the figure controllable. So that the catwalks from left to right, for example, as long as you hold down the “Arrow to the right” key, insert the following scripts:
- Events: If the [ ] key is pressed
- Control: wait [ ] seconds
- Look: switch to the next costume
- Motion: it moves [ ] one step
With the event script, assign the desired key – in the case of our Scratch tutorial “Arrow to the right”. Through the subsequent “control” script, confirm the buffer between the costume change. Should you insert the “0.2” value, then 0.2 seconds will pass before the figure changes its look, which to the motion sequence can seem more natural. The “look” script ensures that between “cat a” and “cat b” is switched, as long you hold the arrow keys. Using the fourth script from the “Motion” section, the figures also move to the right when the costume is switched. We have decided on the standard 10 steps:
You can test the result of this coding example directly via the Scratch project page.
Publish your own Scratch coding project
As soon as you have become a Scratcher and have created your own user account, you can publish your programming projects at any time on the Scratch platform. To do this, click on the “Publish” button in the upper menu bar.
In the window that launches, you now have the option of changing the project title,formulating instructions,andadding comments or acknowledgments. If you move the slider next to “Commenting on” to the left, you also shut off the commentary feature for your project.