Sniff is a "Scratch-like" programming language that's designed to help Scratchers move gently from Scratch to more conventional languages. They can start writing programs, without having to learn a new language because Sniff is based on Scratch. They learn a little more about variables, compiling, syntax errors (!), and they can have fun controlling real hardware while they're doing it.

Friday, 11 September 2015

Sniffpad Secrets

SniffPad is our simple IDE for Sniff. While its not the most advanced IDE  in the world, it serves the basic function of letting new users write code, and compile it quickly, without having to learn a whole load of extra stuff. It has the added bonus of being written in Sniff, which means its portable, and if you don't like the way it behaves, you can always edit the source code and change it!

It's not really suitable for writing larger programs, but we don't really recommend that anyway. There are plenty of good text editors that you can use, and Sniff is really designed to be driven from the command line - SniffPad is just the first taste before you move on to whatever tools you want to use to drive Sniff.

However in R21 we've added a couple of nice features, and there are a few other things that you might have missed. Together they do make SniffPad a whole lot nicer to use.


Lets start with the popup load/save/quit type dialogs. The most important trick is that you can use the up/down cursor keys to scroll through the existing files in the current folder. If you used the 'ClickMe' Script this will be the SniffProjects folder in your home directory. When I run workshops I drop a few helpful examples in here so they're ready to go if I need them. The other trick is that you can use Return and Escape to have the same effect as pressing yes or no.

Cut/Copy/Paste work as you'd expect (though only within Sniffpad, as we don't use the system clipboard), so you can use this to move blocks of code around. You can activate them with Ctrl-X, Ctrl-C and Ctrl-V.

One of the frequent complaints was that the Sniffpad Font was too small, so now we've made it much bigger (by adding a displayFontScale variable you can use in your own code too), but now its perhaps too big. To give you more flexability you can now use Ctrl-B to flip between Big text and the older small text.

The other thing that's new is the ability to indent blocks of code. Quite often you have a long section of code that is working fine, but now you want to only execute it conditionally. That means you have to indent it all by one dot. Now you can just select the lines (or even just a single line if you want) and press Ctrl-I to Indent every line. This is a lot quicker than the old way of going down a line at a time and inserting dots manually.

Similarly if you need to Unindent you can use Ctrl-U, which is conveniently to the left of I on the keyboard.

None of these shortcuts are essential, but they will make using SniffPad a little bit easier.

No comments:

Post a Comment