Computer science with Snap

This book is an introduction to the graphical language Snap!. Snap! is a free graphical programming language. Inspired by Scratch, it builds upon its foundations and expands its functionality.

This resource is suitable for both the novice and experienced programmer. The author, attempts to bridge the gap between graphical and text based languages. This book is a translation from German and in his own words "Unfortunately, I do not speak English well, so it will be bumpy".

Chapter 2: About Snap!

This first chapter is an introduction to Snap and object orientated programming. It is clear from the examples given, that Snap can be used to create complex object orientated systems. The use of object orientation is a requirement of some Level 3 courses and A-level computer science students will find relevance in the simulation model for the spread of a flu epidemic.

Chapter 3: Simple Examples

In this chapter a series of 'simple' projects are used to introduce some intermediate programming concepts.  In the first example the students will create a short animation of a swimmer, the focus local and global variables. The second example is a model of our solar system. This introduces parameter passing and the tricky concept of multi-threading, each celestial body is an independent object. The final project is a caesar cipher encryption tool, it supports the students in dealing with character strings and introduces event handling. 

Chapter 4: Simulation of a Spring Pendulum

This is a more challenging exercise. It might appeal to a student studying A-level Physics.

Chapter 5: Trouble Shooting with Snap!

In this chapter, the author highlights the debugging features of this visual language. The real advantage for the learner, is that local and global variables can be toggled on/off. Practically, this means their values appear on screen as the user steps through the code.

Chapter 6: Lists

The examples in this chapter are particularly relevant for students studying GCSE or A-level computer science. The author works through the following standard algorithms Selection Sort, Quick Sort and Dijkstra's.

Chapter 7: OOP Programming

Object orientated program is an important part of A-level Computer Science. In this chapter the author explains, with examples, how OOP can be implemented in Snap! OPP programming is a good example of how much more powerful SNAP is than its predecessor Scratch.

Chapter 8: Graphics

In this chapter, the author explains how to create simple line graphics. It introduces recursive methods and how to use Hilbert curves to produce unique snow flake designs. It quickly moves on to more complex pixel graphics, explaining how to create a simple RGB Mixer and to use edge detection to manipulate bitmap images.

Chapter 9: Image Recognition

Three examples are given to demonstrate the potential of image recognition in Snap! The first project is a simple barcode scanner, the second a more complex street sign recognition system. The final example is face recognition, this is a challenging problem and Snap! accomplishes it in a way that is accessible to inexperienced programmers.

Chapter 10: Sounds

Like its counterpart Scratch, Snap! is adept at manipulating and processing sounds. The examples given in this chapter demonstrate how to make music and program a hearing check. Accessibility, is a buzz word in computing and this final example could be the basis of a A-level investigation on the topic.

Chapter 11: Electrons in Fields

In this plenary chapter, all previous learning is utilised in the creation of a model of a Helmholtz coil. This simulation will be of particular relevance to A-level Physics students that will have experience of this standard practical.

Chapter 12: Strings and Databases

The focus of this chapter is string manipulation. In the first section the author introduces the string methods that are supported in Snap! These methods are then used to produce a simple Vigenere Encryption program.  A more complex model is then introduced that simulates DNA sequencing and replication. The remainder of the chapter outlines how Snap! interacts with text files an databases. The example program uses frequency analysis to crack a cipher stored in an external file.

Chapter 13: Functional Programming

Functional programming is new to A-level computer science, this is a guide to parsing and calculating functions in Snap! This is a difficult subject and it would be advisable to do some research on functional programming before you tackle this program.

Chapter 14: Artificial Plants: L-Systems

In this chapter L-systems are used to model the growth processes of plants. An L-system consists of an alphabet of symbols that can be used to make strings and a collection of production rules. This is a complex theoretical topic and is implemented in Snap by manipulating lists and creating a basic stack data structure. Whilst student and/or teacher are unlikely to understand the fundamental principles of L-Systems, the code examples represent an easy method of creating realistic plants and can be easily tinkered with to create unique designs.

Chapter 15: Automata

Finite automata and Turing machines are a theoretical topic in A-level computer science. This chapter demonstrates how you can use Snap! to model these phenomena. Taking a practical approach to theoretical topics is a proven way of engaging students. The examples given in this chapter include using automata to improve speech pronunciation and an Internet trading bot.

Chapter 16: Projects

In this plenary chapter, the author incorporates many of the previously covered topics in an ambitious program to create a new programming language.  Some understanding of Backus-Naur form is required to understand the language's specification. The second project in this chapter is a program to visualise statistical data on the Internet and is a nice introduction to graphs and networking. The third example is a simple model of genetic inheritance and the final a website page rank system.

Chapter 17: At the Supermarket

The final chapter is a guide to a rather extensive Supermarket project. It begins by incorporating a SQlite database into a warehouse system. The barcode scanner from chapter 9 is used to produce a cash register program. Image recognition is included in a smart scale program to visually weigh produce. It finishes with a security number plate scanner and face recognition for the marketing department.

Show health and safety information

Please be aware that resources have been published on the website in the form that they were originally supplied. This means that procedures reflect general practice and standards applicable at the time resources were produced and cannot be assumed to be acceptable today. Website users are fully responsible for ensuring that any activity, including practical work, which they carry out is in accordance with current regulations related to health and safety and that an appropriate risk assessment has been carried out.

1 File

You might also like

Resource collection
Resource collection
Resource collection
Resource collection

Published by

    Actions

    Share this resource

    Comments