Thursday, 27 November 2014

How can KS3 use the logic behind coding without coding?










Sunday, 1 June 2014

Computational Thinking

There is more to computer science than programming

The new Computing At Schools (CAS) curriculum puts ‘Computational Thinking’ as a main feature of the program of study. At first, I didn’t pay special attention to the term; I thought as long as it’s something related to programmers and computer scientists, then I must have been doing it for years now anyway, so there’s no need for me to worry about what exactly it means.

With me now being a big supporter of CAS though, I thought I should get a proper understanding of what ‘Computational Thinking’ accurately refers to. After looking at quite a lot of definitions and explanations from different sources, I believe I now have a reasonable understanding of it, but I’ve also realized that this understanding wasn’t gained from one single source but actually by a combination of many.

The top five sources I found useful and that I’ve used in the description below (directly or indirectly), are:

I have two goals for writing this post:
1. To try and provide a simpler description of the term (ideally to spare you having to go through all the sources that I have)

2.  To almost test my own understanding of what information I’ve read, by writing a summary of it – one I can go back to if needed

The term ‘computational thinking’ was first coined by Jeannette M. Wing in 2006.  In a later article of hers (computational-thinking-what-and-why) she referred to the following definition:
Computation thinking is the thought processes involved in formulating problems and their solutions so that the solutions are represented in a form that can be effectively carried out by an information-processing agent1” (an information processing agent can be a human, a machine or a combination of both).

It is reworking what we see as a difficult problem into one we know how to solve. When faced with such a problem, computational thinking addresses the question ‘what is computable?"

From the sources above combined with my own experience, I’ve compiled a list of some of the actions used during computational thinking. The first, in many cases, is ‘decomposition’ which involves breaking up a big task into smaller sub-tasks to make it easier to understand and manage. The following activities are usually applied to these sub-tasks:

Pattern recognition: Using collected data to identify patterns or anomalies.
Being able to read others’ hand writing is done by identifying the general pattern of the letters and comparing them with the example patterns of each letter that we have in our head. Those that we can’t recognize are anomalies in this case. We also identify patterns in people’s behaviour depending on different stimulus and build our future interactions with them accordingly.

Abstraction and pattern generalization: Filtering out unnecessary information for a certain context and keeping only what is generalizable.

: ) is an ‘abstraction’ of a smiling face. Only the very general features of a smiling face are kept (a curved mouth and two eyes). Everything else about the face is left out, yet everybody knows that a colon and a right bracket is a smiley face.

In some cases, multiple layers of abstraction are used to bridge the gap between what is considered useable/understandable by humans and what a machine can use. All ‘easy-to-use’ computer programming languages  use it to turn the 1s and 0s that the hardware deals with into a human readable presentation.

Algorithm design:
developing a step-by-step strategy for solving a problem (one that others can follow without thinking). It’s particularly useful when a  task needs to be repeated multiple times or when a task needs to be carried out by others (including machines)

Preparing a cooking recipe for a friend

Prefetching and caching in anticipation of future use.


Putting things into a school bag or travel bag is ‘prefetching’ for future use. Keeping a tool next to you in case it is needed or to avoid fetching it again is ‘caching’ with the aim of saving time.

Making trade-offs between time, storage space, processing power and complexity.

Should you, very quickly, put the things you need for a trip in a big bag, or spend time to pack things very efficiently into a smaller bag (time vs storage)

Approximation: considering if approximating the current problem into a simpler one (either by simplifying the problem itself, or the information available) will still give us good enough results.
If I need to roughly estimate the cost of a shopping list in a shop, do I need to use the exact prices up to the penny when adding numbers, or can I just approximate to the nearest pound (or in the unlikely case of a very expensive shopping list, to the nearest ten or even a hundred pound!)

Performance modelling

Which line should you stand in at the supermarket, or which route should you choose when travelling to a certain destination?

Apart from the activities above, there are certain approaches to solving problems used quite often in programming that we benefit from in real life without knowing that these are well defined techniques with jargon names such as a ‘binary search tree’. You’ve probably used ‘binary search tree’ without knowing that it has a name and here's an example for it:

A computational thinking example: Guess a number

A few days ago, I was playing ‘guess the number’ with my 7 year old daughter. One of us thinks of a number between 1 and 100 and the other has to guess it. After a few tries, she noticed that I normally guess her ‘secret’ number faster than she guesses mine. So she asked me how I did this. What I was actually doing was using a ‘binary search tree’ technique to guess the number. I explained to her in the simplest way I could think of that she should always give a guess that is the number ‘roughly’ in the middle of the remaining range and she is guaranteed to guess the number in no more than 7 guesses (obviously without explaining why).
I compared this to her random guessing technique and told her that in this case, that may require many more attempts (100 in the very worst case). She obviously experimented with several examples before taking my word for it.

This is a very simple use of computational thinking to show off in front of a 7 year old: “I can guarantee you I’ll guess your secret number in no more than 7 attempts, or to make it more interesting, a number between 1 and a 1000, in no more than 10 guesses”.

Suppose the range is 1-100 and the selected number is 17 (the following scenario is a worst case scenario):

1- Is the number 50? (No - smaller)
2- Is the number 25? (No - smaller)
3- Is the number 12? (No - larger)
4- Is the number 18? (No - smaller)
5- Is the number 15? (No - larger)
6- Is the number 16? (No – larger)
7- The number is 17

Another practical example of computational thinking is using sorting to speed-up search. If you are the person in front of the CD player at a karaoke party with a 100 CDs, finding the required songs will be much faster if these CDs are sorted alphabetically than if they are in a random pile. When the CDs are sorted, your brain is doing some form of binary search to quickly find the right one without you even realizing it. Combining sorting and binary search is one of the most widely used searching techniques in computing.

Back to the term

According to Wing, Computational thinking is not an optional skill, but a fundamental one that everybody should learn, to function in our modern society. It complements and combines mathematical and engineering thinking.

Computational thinking is not just about computer software, but also the concepts we use to solve problems in our daily lives.

1- Jan Cuny, Larry Snyder and Jeannette M. Wing, "Demystifying Computational Thinking for Non-Computer Scientists," work in progress, 2010.

Tuesday, 29 April 2014

Which programming language should you choose?

With so many programming languages to pick from, it can be difficult to decide which one to teach students. I wanted to share my experiences from my background as a programmer and help narrow the options down.
If you are to teach KS3 and KS4, the very short answer, in my opinion, would be JavaScript and this post explains why.


Teaching programming to KS1 and KS2 will most likely not go beyond explaining some basic concepts and writing simple programs in special learning tools (e.g. Scratch). Students in KS3 and KS4 however, will probably want to program using a ‘real world’ programming language. This can be more motivating for students at that age, and could even teach them a skill that they can use outside school or later on in their career.


The issue I see here is deciding on which programming language to teach. Personally, I have used many programming languages over the years, starting with Basic in the early eighties to Pascal, C, C++, Java, C#, and most recently JavaScript. For this discussion, I am focusing on the programming languages I have used, but of course there are other languages that can be good candidates such as Python. Omitting Basic, Pascal, C, and C++ because they’re either not popular anymore or too difficult to learn, leaves us with Java, C# and JavaScript.

  • C# - while being my favourite programming language, is limited to the Windows platform and I think this is a big disadvantage in a time when platforms such as the iOS and Android are dominating the mobile devices market.
  • Java (which by the way, has nothing to do with JavaScript despite what its name may imply) has some big advantages. It is easy to learn and is platform independent, meaning that it can work on any machine, plus it is the main programming language for Android devices, and that is a big plus. Also, its resources and development environments are mostly free. You can’t go wrong with teaching Java so it’s definitely a good option and many computing science departments at universities go for it as their main programming language.

Recommendation: JavaScript

If it was up to me however, I would go for JavaScript. My reasons for recommending JavaScript are as follows.

  • Its basics are very easy to learn for a beginner
  • It is platform independent, so it’s possible to run the program on any device with a web browser.
  • All the required tools are free – students can start simply with a text editor (e.g. note pad), and a browser (e.g. Chrome or Firefox).
  • JavaScript is part of the HTML5 standard which many expect to be the new de facto standard for writing multi-platform applications.
  • Accordingly, it also requires knowledge of some HTML (at least the very basics), and with HTML being the actual webpage that eventually hosts the JavaScript program, learning basic HTML is very useful anyway as it is the standard for defining web pages.
  • It is a skill that students can use outside the classroom to develop interesting interactive webpages and a skill that some of them are very likely to need in any IT related career.
  • It is COOL to learn because it is basically the language that made the web interactive.

Having said all that, it is important to stress that what is more important than learning the specifics of any language, is learning the main concepts of programming. Once the concepts are mastered, switching between languages is, in most cases, a very trivial thing. While I am recommending JavaScript, I think you can’t go wrong with Java or Python as well.

I hope that this has been useful.

Tuesday, 1 April 2014

The mystery of teaching computing at schools

As a person who has been programming since the age of nine, which was a long time ago, and as an academic researcher in computing science whose focus is on education, I am very excited about the new Computing At School curriculum to be introduced later this year. Regardless of the arguments about the approach to that and the timing, I am totally in favour of introducing students in more depth to computing and computational thinking. It provides the students with problem solving skills that are applicable to many other disciplines and to today’s and tomorrow’s world as well.

When it comes to using tools to support teaching the new curriculum, a number of tools come to mind to help teaching programming and writing algorithms such as MIT’s Scratch, Kudo and Logo. However, even when talking specifically about algorithms, there is much more to programming than simply being able to write or understand an algorithm. Students need to understand that there are many algorithms to solve the same problem. In most cases there are compromises between the speed of the algorithm and the time it takes to implement it, or between writing code that is easy to understand, debug and modify and one that executes fast but is hard to maintain. This is just one example of the many decisions that programmers need to make, and existing tools may not be as well suited to raising or discussing such issues, as they are other elements. Arguably, understanding the benefits and shortcomings of different ways of solving a problem - and the compromises that need to be made based on the specific circumstances - are more useful life skills to learn than knowing how to actually implement an algorithm.

There are many other topics in the curriculum that can be taught best by engaging students in open discussion with their peers and their teacher. This is especially true for topics such as; judging quality and reliability of information obtained from different sources from the web; using digital content responsibly; and understanding the consequences of publishing and sharing personal information. As recommended by different guides on the new curriculum, working collaboratively in groups can bring many benefits to students, especially for such topics that have an open question with no one, clearly right answer. Encouraging students to engage in discussions about such topics does not only help them learn better about the topic but also helps in the formative assessment of the students. Discussions help the students elaborate on their understanding which consequently can identify missing knowledge or incorrect understanding that need to be addressed by the teacher.

While in researching and developing the concepts behind Digital Mysteries - a tool to promote collaboration and thinking skills - at Newcastle University and later at Reflective Thinking, using it as a tool for supporting the teaching and learning of IT related subjects was not part of the plan. However, looking carefully at the new computing at schools curriculum and at the existing tools that can assist in that, it seems as if Digital Mysteries can fill an important gap in the pool of existing resources. We plan to collaborate with educators and make use of our experience in computing to develop the sort of materials that complement existing programming tools in order to help teachers address the subjects in the curriculum that do not directly involve understanding and writing programs and algorithms.

I hope for this to be the first of a series of blog posts about the introduction of the new Computing At Schools curriculum. My first active step is to write our first mystery on the subject.
I’d really like to know your thoughts, so please feel free to comment and make any suggestions for future discussions.