Getting back to BASIC (Microsoft Small Basic)

This content is 9 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I’ve written before about my son’s interest in computer programming (well – computers in general, as it seems he provides IT support for his class!). It started with Scratch (at school), we went to an Apple Store for an Hour of Code last year and now, inspired by watching episodes of the BBC’s Making the Most of the Micro series from 1983, he’s moving up to BASIC.

After a short hunt on the ‘net I found a Windows port of BBC BASIC but I wondered if he might be better using something that prepared him for other, more modern, languages (my own path went something like RM BASIC, Turbo Pascal, Modula-2, 68000 assembly, COBOL, SQL, C, C++, VisualBasic, HTML/CSS, C# – although in truth the closest I get to writing code these days is a little bit of PowerShell every now and again). Then I found Microsoft Small Basic. After a late-night on Friday getting back to BASIC myself (with a multiplication tables programme which I’m sure professional coders will baulk at, inspired by Ian McNaught-Davis in episode 2 of Making the Most of the Micro), I felt I’d re-familiarised myself enough with BASIC to get my son started – and he really took to it, moving on to graphical windows on Saturday afternoon.

I started out looking at Beginning Small Basic (there are other Small Basic programming books available online too) but the Small Basic reference documentation in the TechNet Wiki came in useful too (like when looking up the available colours).

If I have one gripe with Small Basic, it’s that it doesn’t seem to understand multi-user Windows computers: I installed it using my account, but it wasn’t visible when my son logged in; I reinstalled and now it’s not there for me. Nevertheless, it’s a great way to get stuck in to programming, before “graduating to Visual Basic” or hopefully he’ll be learning something else, like Python, at school soon.

It’s interesting to see how today’s nearly-11-year-olds view the computers of 1983 (by co-incidence, 1983 was the year when I turned 11 too…). Green screens, cassette tape input, floppy disks (none of those new-fangled 3.5″ disks either), dot matrix printers, character-based interfaces (only a few days previously he had asked me what I was doing in cmd.exe) – will my grandchildren view touch screens and patchy mobile phone networks in a similarly quaint manner in 2047?

Just for reference

My first Small Basic programme is below (although WordPress has stripped out the indentation). I’m hoping my son can do much better!

Start:
TextWindow.Title = "Multiplication Tables"
TextWindow.Write("How many tests would you like? ")
Tests = TextWindow.Read()
Loop = 0
Right = 0
Wrong = 0
For Loop = 1 To Tests
TextWindow.BackgroundColor = "Blue"
TextWindow.ForegroundColor = "White"
FirstNumber = Math.GetRandomNumber(12)
SecondNumber = Math.GetRandomNumber(12)
Result = FirstNumber * SecondNumber
Output = "What is " + FirstNumber + " multiplied by " + SecondNumber + "? "
TextWindow.Write(Output)
Answer = TextWindow.Read()
If Answer = Result Then
TextWindow.BackgroundColor = "Green"
TextWindow.WriteLine("Yay")
Right = Right + 1
Else
TextWindow.BackgroundColor = "Red"
TextWindow.WriteLine("Uh, Oh!")
Wrong = Wrong + 1
EndIf
EndFor
TextWindow.BackgroundColor = "Purple"
Output = "You got " + Right + " correct answers and " + Wrong + " incorrect answers"
TextWindow.WriteLine(Output)
TextWindow.WriteLine("Would you like to try again? ")
Answer = TextWindow.Read()
If Answer = "Yes" Or Answer = "yes" Then
Goto Start
Else
Goto End
EndIf
End:
TextWindow.BackgroundColor = "Black"
TextWindow.WriteLine("Goodbye")

Moving on from an #HourOfCode to 20 hours of code…

This content is 10 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

A couple of weeks ago, I wrote about the Hour of Code events that are running as part of Computer Science Education Week and, last Thursday, I took my 10 year-old son to our local Apple Store to take part in an event. Unfortunately his younger brother wasn’t interested (“I don’t really like programming” was the response) but I’m not going to push it – not everyone likes the same things and I do at least know he’ll be exposed to some coding at school (Scratch was part of the ICT curriculum at their school, even before the recent shake-up in computer science education here in the UK).

Using a Scratch-like user interface, the Hour of Code used a sequence of puzzles to guide Angry Birds through a route to find some pigs, the Zombies and Plants, and Squirrels and Acorns… with the opportunity to view the resulting JavaScript code at each stage.  Working up from simple steps forward/turns to repeat [for] loops, repeat until [while] loops, if statements and if/else statements it was great to see my son asking “what are all the funny brackets” when he viewed the code (and equally great to be able to use some of the C he’s tweaked with the Arduino as an example of passing parameters).

At the end of the session we were pointed at another twenty hours of code available at the code.org studio, allowing kids (and adults) to build up confidence and knowledge of basic computer science principles but the real buzz for me was seeing my son’s browsing history the next morning, spotting the Google search for “20 hours of code” and the fact he’d got stuck in to some of the puzzles to create his own game without any nudging from his geek father. That put a big smile on my face.

Learn the basics of computer programming in an #HourOfCode

This content is 10 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Next week (8-14 December 2014) is Computer Science Education Week and the Hour of Code is coming to the UK. More than 3 million people have tried an Hour of Code already, in an initiative that aims to dispel any myths that computer programming is difficult and to provide parents, teachers and students across the nation with an enjoyable introduction to coding. Code.org hope that this will help build awareness of and confidence in the changes that have come in the September 2014 English school curriculum.

It’s not just in schools either – my employer has 24 “hour of code” workshops scheduled all over the country for our technical staff to give non-techies a one-hour introduction to the basics of computer programming and there’s been a fantastic sign-up rate.

Other IT companies are getting involved too (actually, there’s an extensive list of partners) including Apple, who are hosting Hour of Code workshops in Apple Stores across the world on 11 December (I’m hoping to get at least one of my sons to come along with me). It’s billed as “no experience needed” and for “ages 6-106”.

If computer programming is a mystery to you but it might be something of interest, find out more about the hour of code on the Code.org UK website or follow @codeorg on Twitter.

And if the Hour of Code whets your appetite, you might like to check out some of these resources:

[Update 10 December 2014: added Microsoft Imagine to the list]

[Update 14 December 2014: added 20 hours of code to the list]

Code dojo for test-driven development

This content is 10 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Every now and again, I think it would be great to do some coding, to give up this infrastructure stuff (or at least to give up the management stuff) and solve problems programmatically for a living.  Unfortunately, I also have a mortgage to pay, and certain expectations on living standards, so rewinding my career 20 years and starting again is probably not an option right now…

Even so, I took a C# course on PluralSight and, last month, I attended the Code Dojo that my colleague Steve Morgan (@smorgo) was running for some of the developers in Fujitsu’s UK Microsoft Practice.

Dojo is a Japanese word that means “a place of the way” with various explanations including a place where a group of people stay to discipline themselves.  So, it follows that a Code Dojo is a place where a group of software developers come together to be enlightened.

Our Code Dojo focused on a Kata, which is another Japanese term that literally means “form” – i.e. describing patterns of movements practiced solo or in pairs.  In this case, the pattern that we followed was one of Test Driven Development (TDD).  We used TDD to implement a software solution to a given set of requirements but, like all projects, the requirements start off incomplete and there are new requirements received at each stage of the project.

We each took it in turns to write code (even me), with the rest of the group observing and offering help where necessary.  The principle of TDD was used to write unit tests that are machine-executable expressions of requirements.

First, we wrote a test for a single requirement and then attempt to run it.  It should fail because the requirement isn’t implemented so we wrote just enough code to satisfy the requirement (and no more).  The next step is to run all tests and, if any fail, fix the failing tests or the implementation until everything works.  Finally, we refactored the code to make it more maintainable and supportable.

Very quickly, we had grasped the TDD mantra of “red, green, refactor” – i.e. at least one test fails, fix the code to pass the tests, then improve the code but tests must still pass.

The event was over all too quickly, and we ran out of time, but it was certainly worthwhile – and a great education for me.  we used C# and Visual Studio but really you could use any language to apply the principles and I really should give it another go at home.

Steve’s next Code Dojo is today but I can’t be there as I’ll be cycling to Paris as you read this (and, even if I wasn’t, I’d need to be at a management meeting!). Hopefully there will be more soon and I can continue my education…

Learning Scratch, from an eight-year-old

This content is 12 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Much has been written in recent years about the state of ICT education in Britain’s schools, so imagine my pleasure when my wife told me that my son was learning Scratch at school. I’d hoped that he would do something more than Microsoft Office and Google soon but had a suspicion we might have to wait for secondary education (he’s currently in year 3).

I asked him about it and he seemed really enthusiastic, so I asked if he’d like to do some more at home. Then, this weekend, I plugged the Raspberry Pi into the TV, loaded up Scratch, and asked him to show me how it works.

Wow! After two lessons at school, he’s off and away. Within a few minutes we (actually, no, I was a bystander – it was my son doing the “driving”) were drawing shapes on the stage with a helicopter sprite. He progressed from squares, to circles, changing the colour as each pixel was drawn on the screen, then worked out how to draw triangles and within a short while was doing what I can only describe as the modern equivalent of a Spirograph (remember them?), running two scripts in parallel with a single keypress.

Scratch

I was about 12 before I got my first computer (a Sinclair ZX Spectrum+) and took my first tentative steps in BASIC. Meanwhile, my kids are growing up in a world of smartphones, tablets and netbooks. It’s fantastic and I only wish there was some special STEM (Science, Technology, Engineering and Mathematics) programme at his school as he clearly enjoys it (sadly, he finds writing more difficult and I had to “bribe” him to complete his spelling homework by saying he could have some more time in Scratch if the spelling was completed without any fuss…). Private education is out of our reach but I’m pleased he’s getting exposure to Scratch at such a young age.

I’ll have him on JavaScript and C# next!