BBC Basic

In my look at different languages for use in GCSE computing, I never even considered BBC Basic*, so it was a surprise to discover that it’s the language used in examples given out by OCR and the language used in a new coursebook.

BBC Basic was one of the original languages used in schools, on the BBC Micro.  Back in those days, as I recall, all users learned a form of BASIC – I myself learned Sinclair Basic, on the ZX81.  At that point, each line of code needed a line number, and it was possible to jump from one line of code to another using a command called GOTO, which could result in code that could be hard to read.

password checker in BBC Basic (from OCR)

password checker in BBC Basic

Now it seems that BBC Basic has been updated into a version for Windows.  There is a free version available for evaluation purposes, which limits the size of programs and prevents you producing a stand-alone version of the code.  A paid-for licence is available to lift these restrictions.

My concern is that I cannot understand why this language would be a language of choice for teaching computing.  It’s described as easy for beginners to learn, and it’s based on a language that may be familiar to those who learned their programming a couple of decades ago, but I can see no inherent benefit in using a language that’s purely for teaching and not used in any professional developments, as far as I’ve been able to find out.

I’ve tried hard to show an interest in this language, really I have.  I don’t know whether I have some deep-seated aversion to Basic, but to me this looks clumsy and hard to read, and there seem to be other languages that are free, used professionally and are far easier to read and understand at a glance than this one.  There seems to be no hook to say that BBC Basic is better because…, just the feeling that BBC Basic was the original teaching language so it should still be used.

password checker in Python

password checker in Python

Am I missing something?  Is there some aspect of BBC Basic that makes it better than Python or Java to use?  Because I’m disappointed that OCR have chosen to release their sample code in this one language rather than provide a selection of examples.  The justification given in the book for using the language is that BBC Basic is very close to pseudocode, but I don’t see that it’s any closer than other languages, and I’m left with a feeling similar to one I felt when I originally learnt Basic – that it’s all very well, but it’s not a proper language that is actually used to create real projects.

Feel free to correct me, but this feels to me like something that is being pushed for nostalgic purposes rather than because it’s a good tool for the job. Or am I just carrying over my old teenage prejudices, with all the frustration of trying to write fast, playable games with a tool that was just too slow to work that way?

PS: Originally BASIC was always given in capitals, as an acronym for Beginners’ All Symbolic Instruction Code, but these days it seems to be adopted as just Basic. 

Simon says – Time to play!

the scratch version of simple simon from MagPi magazine

the original Scratch project, courtesy of MagPi

Well, we’re back at school now and settling in.  I’m looking forward to the first few computing classes next week, but I took time out this weekend to have a play on Scratch and BYOB.  I started off with a project from the latest MagPi magazine, on building a Simple Simon game in Scratch.

The game itself was straightforward, following the code given, although I was reminded in the process exactly what the broadcast and wait block does (broadcasts a message then suspends activity on that thread until the receiving thread has finished). That might well come in handy when I sort out the animations for my virtual pet, as I’d been concerned that other scripts might interrupt any animation that’s run.

However, when I played the game, I found one thing that didn’t feel right – it generates a four tone/light sequence, asks the player to repeat it, then generates a completely new five-tone sequence, which quickly makes it very difficult to play as the difficulty increases.  I seem to remember that the original version of the game would add one to the sequence each time, rather than changing it to a new sequence, so I decided to produce my own version and move it up to BYOB in the process.

The game loaded fine from Scratch, although there were one or two issues with the length of list, which apparently is handled slightly differently between the two programs.  However, I was soon picking the code apart and working on the alterations I wanted.

the block I built to cycle through a list and broadcast each item

the block cycles through a list, broadcasting each item in turn

My first problem was that the original game would generate each tone, broadcast it and then add it to the list.  If I was going to add a number to the existing list, I would need to find a way to cycle through all the objects in the list, broadcasting them one by one.  This seemed an ideal candidate for a self-built block.

Looking around the help system for BYOB and finding words like predicates thrown around merrily made me realise that despite appearances this definitely is not just for kids – while kids can quickly get up and running doing something with Scratch, it’s capable of some pretty powerful stuff, even more so in the BYOB version, although the more high-powered you go the more fiddly it gets to produce the blocks needed, with blocks within blocks within blocks.

Simple Simon game, BYOB version

Simple Simon BYOB version

I had to modify the flow of the main program in order to set up a 4 tone sequence, broadcast it, wait for response, then check it.  If the response is correct it adds to the score, generates and adds a number to the sequence then rebroadcasts, while if the response is wrong it takes a life away and replays the sequence as it is.

I definitely needed paper to scribble my thoughts on to work out the logic of the program, but it went together fairly well.  You know when a game is playable, when you have problems forcing yourself to test it rather than just playing!

The new version is more playable than the original, it makes a little use of the extra facilities of BYOB and I learnt a lot about the use of lists in Scratch/BYOB in the process.

The game currently keeps score during the game but is reset on restarting – one improvement would be to add in a high score variable, to keep track of the highest current run. I could also start the score at 4 instead of 0, so that it reflects the number of notes in the sequence.  An alternative would be to start with a one-note sequence, but that might make the game too slow to get started.

 

An amazing summer

It’s nearly time to go back to school, so my time spent blogging/playing with computers is likely to drop rather, but I just wanted to look back on what turned out to be an amazing summer, completely different from the previous few.

It started with me realising that while many years ago I looked up to those older than me, and more recently that has crept to admiring the work of my own generation, suddenly I’m finding that those younger than me are doing wonderful things – somehow it feels like life has passed me by and moved on, and it’s the next generation now pushing things forward.

I’ve learnt about things like hackspaces, where people gather to share ideas and make things, and I’ve learnt about coderdojos, where people, including kids, come together to develop their programming skills.  I’ve learnt about hackdays, where people come together just to get some concentrated coding done and to learn and share.  I’ve learnt that if something doesn’t exist you don’t just complain, you go out and build it, and make it look good into the bargain, and the end product can matter less than the learning from the process.  I’ve learnt to solder, and started to learn basic electronics.  I’ve learned that people do indeed use HTML to create clean-coded web pages, and that reading other people’s code can be fun as well as a learning experience.  I’ve played around with several different programming tools, and learnt some of the advantages and disadvantages of them.  I’ve revisited a lot of my learning and discovered that I haven’t forgotten as much as I thought, and that I can do more than I always imagine.  I’ve improved my multimedia skills as well as programming skills, because communicating is just as important as programming when it comes to a complete project.

I’ve learnt that it’s an amazing, exciting world out there for someone who wants to learn, because there are so many ways to find things out – not just books, as there was in my youth, but websites with written content, images to look at and even demo videos to watch.  There are colleges and universities out there offering learning for free, and plenty of people to share the learning with.  Many people who are out there working on various projects are able to do it not because they studied officially for years, but because they went out and got the learning they needed, in whatever way they could.

Kicked into action by this, I started to do things for myself, instead of just sitting wishing, and so I’ve done a lot of coding, both on projects from books and on my own projects.  I’ve written games and apps, and developed my understanding of how and why games work, and how computers can control so many things around us and why it’s so important to know exactly what you want and to be able to explain it clearly.

I’m ending the summer a lot more confident about what I can do and what pitfalls to look out for, and with a conviction that the time is coming when more and more people are learning to make and do things for themselves, and that for those in that position there are many opportunities to succeed.

I just wish there were more opportunities locally to meet up with like-minded people, because however much fun it is to meet people in cyberspace, it’s got to be even more fun to get together in person, with the fun and games that can ensue from that.

Raspberry Pi time!

Although I have had the pi out and working once before, it’s been a while and there’s a new distribution out for the software, so it was like starting all over again: the first thing I needed to do was to download and unzip the new distribution (Raspbian wheezy) from the pi website.  This needs to be copied onto an SD card before you start.  You have to use a disk imager to set up the SD card, it can’t just be copied over, but I’d already downloaded a free disk imager ready.

pi with case

pi with case

The operating system for pi is a linux distribution, with a graphical interface very like Windows available. It also comes preloaded with several pieces of software such as Python and Scratch, making it very fast to get up and working for programming purposes.  It took about 20 minutes altogether to download the software and copy it onto the SD card ready for use, and then I could start plugging things in.

The pi comes with two USB sockets which are usually taken up with keyboard and mouse, and as the operating system is installed onto an SD card which needs recreating for a new setup, this time I was also trying out a powered USB hub, so that I can save any work I do onto a separate memory stick rather than on the SD card.  The Pi itself isn’t powerful enough to run a hub, so it has to be one with its own power supply.

I hit a major problem when connecting the screen – as I explained in an earlier post, I need to use an adapter to connect my screen to the pi, and it had a rather troublesome connection, but eventually we managed to get it working.  So I had the pi up and running, with powered hub running keyboard, mouse and memory stick, and with a cable draped across the room to the router to give an internet connection as well.

I was disappointed to note that this new distribution seems to have a lot less than the previous one in the way of preloaded software, but the essentials are there – web browser, python 2 (with pygame) and python 3 (without pygame), plus Scratch.  Squeeze is also listed, but didn’t seem to load up.

There is also a folder of python games, taken from the book Invent With Python, which I copied onto the memory stick to bring back to my main machine and look at.

The browser seemed to work with no problems at all, and it was as easy as plugging in the cable and typing in a web address to get online with the Midori browser, so that was the basics up and running, although I couldn’t see how to access the memory stick directly from applications such as Scratch – my husband said something about mounting the drive, but I felt copying over is enough for now, until I get to the point of using the pi properly and having files worth saving directly onto the external drive.

I feel now that maybe I’ve reached the point where I need to start looking carefully for instructions, either via the MagPi magazine or some of these books that have sprung up about the pi, in order to take it any further.  Scratch and Python are fine with no issues for me, but the operating system is a little unfamiliar for anything outside the very basic and I’m not confident enough to go poking around, downloading stuff and installing it without advice.

I do believe the pi is a wonderful gadget, but as yet I don’t think I’ve identified its full purpose – as a really cheap machine available to encourage kids to play with programming, it’s great, but apart from its price it doesn’t offer that much different from a desktop machine. I understand you can use it for input and output devices, rather like the arduino, but that again is something that would need research and setting up, although it does seem to me that one major advantage for the pi apart from price is the physical size of it and that seems to be begging to be embedded in some sort of system.

I think it’s time to go off and do some research into what people are using the pi for, and what it’s capable of!

PS the case is great for protecting the pi as it sits on  my desk – I found it on my husband’s desk (around his pi in fact! shh!)