Efficiency Is Our BIDMAS
Why you should start discussing "efficiency" at the earliest available opportunity.
Despite the protests of some teachers when Computing replaced ICT in 2014, programming has always been in the National Curriculum. For example, the 1995 National Curriculum for Information Technology said of students that we should ensure that:
They develop, trial and refine sets of instructions to control events, demonstrating an awareness of the notions of efficiency and economy in framing these instructions.
In fact, older versions of the National Curriculum included an important word that's missing from the current version - "efficiency". Almost thirty years ago the National Curriculum required students to program efficiently, and that comes from the description for level 6 - i.e. a moderately good year 9 student.
The current curriculum does say that KS3 students should…
use logical reasoning to compare the utility of alternative algorithms for the same problem
…but up to GCSE there's really only cursory mention of efficiency in relation to searching and sorting algorithms. Exams occasionally ask how many times a line of code inside a loop is repeated, but there's really no mention of creating things that are efficient.
A few years ago I saw a discussion about a GCSE programming task in an on-line forum - it was using a brute force method to find a particular value. A number of contributors had suggested the same solution - using nested loops, each repeating one hundred times, to perform a calculation 10,000 times. When I suggested that it would be more efficient to use a single loop to find the answer in less than twenty iterations, there was an almost-unanimous response that an efficient solution wasn't one of the requirements of the task.
I also teach some GCSE Maths classes, and occasionally I ask my students when they need to remember to use BIDMAS (PEMDAS for readers in the US and Australia) to perform a calculation. The answer, of course, is "Always!", even though BIDMAS is never mentioned in the question.
There's a BBC4 programme called The Wonder of Algorithms (it's occasionally repeated, so keep an eye out for it on iPlayer). In it they described how the University of Glasgow developed software to help match transplant organs to recipients. The patients and doctors were obviously pleased that it worked, but the computer scientists were disappointed that it took so long to run. For me, that epitomised computer science - efficiency is what it's all about.
So while a programming task might not include the requirement for "efficiency", I think that it's implicit in the whole subject.
I've mentioned before that when Computing was first added to the National Curriculum, my first thought was to teach programming using a really slow computer. But efficiency applies to all aspects of Computing, not just how programs run or how much primary or secondary storage is required for processing and output. We can also apply the idea of efficiency to:
- creating source code in the first place - we teach things like the use of functions and procedures to avoid repeating sections of code (which I don't think will have a great impact on the efficiency of the running program), but there's also the effective use of techniques such as copying and pasting, search and replace, etc. When creating a list of strings in Python, for example, I find it quicker to repeatedly paste the string "", before adding the values
- creating web pages and other documents:
- using correctly-sized and compressed images and cropping areas that aren't required
- using the most efficient file format, e.g. PDF, RTF, CSV (portability will also be a factor to reduce the time spent converting a file)
- using "web safe" fonts so that the page will render correctly on all devices without the need to "embed" the typeface
- reducing the number of HTTP requests, e.g. by using CSS sprites
- using tools such as GTMetrix or PageSpeed Insights to measure loading speed, cumulative layout shift, etc.
- carefully structuring page content to make the page easier to find
- i.e. ICT National Curriculum required us to consider suitability for the "audience" - I think we've moved beyond fonts and colours but we need to think about users with smaller screens, or who are using slow or limited data connections
- choosing a network topology to minimise the amount of cable used (or finding the shortest path through a network)
- using mathematical techniques to manipulate Boolean algebra to simplify logic circuits
- environmental considerations - there are league tables of the "greenest" programming languages, for example, and things like the creation NFTs and cryptocurrencies require a great deal of (computing) power
- appropriate use of ICT - e.g. the use of time-saving tools such as spreadsheets and databases, the use of software for experimentation, re-drafting of documents, etc., and also consideration of when it might be better no to use ICT, e.g. to leave a note to say you've popped out and what time you'll be back
So, just like BIDMAS, if you were to ask me when I'd think about efficiency, the answer would be "Always!". People often ask how we'd change the National Curriculum if we were given the chance - I'd like it to promote the importance of efficiency.
This blog was originally written in February 2024.