• Question: What is something that looks very simple to all of us but actually has a very complicated code behind it?

    Asked by anon-257014 on 11 Jun 2020.
    • Photo: Andy Smith

      Andy Smith answered on 11 Jun 2020:


      I think most of us take video streaming services like iPlayer, Netflix and YouTube for granted. We open the app, pick the show we want to watch, and it instantly starts playing. But there’s a massive amount of complexity sitting behind this.

      Just opening the app involves lots of communication between your device and servers on the internet to verify who you are and to log you into your account. There’s some very complicated maths being used to encrypt your username and password so that it can’t be stolen.
      A load more complicated mathematical calculations are used to compress the video data into a smaller size so that you can start watching the video immediately instead of waiting for it to download.

      And then once you’ve finished watching one video, your app might show you some recommendations about what video you might want to watch next. This recommendations code is so complicated that a human just isn’t smart enough to work out how to program it. Instead, a machine learning system (a type of artificial intelligence) is used.

      Thankfully you don’t need to be a maths genius to write computer programs. Some very smart maths geniuses have already done a lot of the hard work to write these complicated algorithms and put them into pre-packaged blocks of code, or “libraries”, which the rest of us can use in our own apps.

    • Photo: Martin Coath

      Martin Coath answered on 11 Jun 2020:


      I think Andy’s answer pretty much covers it.

      But just to add that ‘complicated’ doesn’t really describe computer code very well.

      It takes skill and patience to write good code, but the ideas expressed are usually pretty simple. In some ways the art of programming is to take a very complicated idea like ‘show me a movie I am going to like!” and break this down in to the simplest possible steps. So the code is always simpler than the idea because computers are simple devices 😀

    • Photo: Tom Dack

      Tom Dack answered on 11 Jun 2020:


      The others have both got this spot on!
      If you take it to its most basic, coding is all about problem solving – and then converting that solution into instructions in a language your computer can understand! Different languages can be good at different problems, which is why so many different programming languages exist.

    • Photo: Stephen Powley

      Stephen Powley answered on 12 Jun 2020:


      Good answers from the others. It’s also worth thinking about all the everyday objects that use code, from, shoes to cars, toasters to toothbrushes. These links have some good examples:
      https://www.nissat.org/everyday-items-rely-computer-code/
      https://www.codefellows.org/blog/7-everyday-things-require-coding/

      Code for these everyday objects is usually referred to as “embedded software”. These embedded systems usually take information from sensors that give information about the world and process it to produce actions. This could be sensing somebody’s hand waving to turn on a light, or using radar to keep an autonomous car in lane on the motorway.

      It’s a really interesting area of coding to explore because you can make things happen in the real world. If you’d like to experiment yourself, there are lots of kits that can help you make your own devices with embedded software – take a look at:
      • micro:bit https://microbit.org/get-started/home-learning
      • Arduino https://www.arduino.cc/en/Guide/HomePage
      • Raspberry Pi https://projects.raspberrypi.org/en
      • Crumble https://redfernelectronics.co.uk/crumble/

      Your school might have some kits that they could lend you (ask your teacher) and there are lots of tutorials on YouTube.

      Good luck

    • Photo: Steve Williams

      Steve Williams answered on 12 Jun 2020:


      Perhaps the most complex of all codes is the code for life on earth written in all our DNA. Not consciously developed but evolved over about 2 billion years. There is active research into developing software using the same techniques as evolution but massively accelerated in time using the computation power we have today. I think these ideas are another branch in the development of Artificial Intelligence.

      In conventional software development complexity is something to avoided and considered as something of a trap not to get caught in. Its all too easy to write complex code and it’s usually because the fundamental understanding of a problem to be solved has not been completely achieved – the software engineer started writing the coding too early in the process. In software development complexity management is a key skill. This by the way is great question and a subject where there has been much written in the text books.and research papers.

    • Photo: Lucy Craddock

      Lucy Craddock answered on 12 Jun 2020: last edited 15 Jun 2020 12:57 pm


      I think an interesting concept to code is a loading screen. When you are waiting for a game to load or software to install, you are faced with a bar that fills up as ‘progress’ is made. Have you ever considered how the computer knows it’s halfway done?

      How do you create a program that analyses another program’s progress? This is quite a tricky problem to face as all computers have different resources, the jobs will differ for different situations, and ‘progress’ itself is difficult to measure. ‘Progress’ is usually calculated as small jobs are completed. This is often confused as most loading bars show ‘time’ left when these are only estimations based on the average time for the jobs.

      This is means that loading bars are always inaccurate. This is why you’ll see the ‘time left’ changing, and also why loading bars are typically stuck at 99% as the last 1% of the job typically takes longer.

      Although this is fairly easy to code, the concept itself can be quite complicated. The most fascinating about coding to me is finding beauty in creating simple solutions for complicated concepts. Especially in this case since the solution is technically wrong; however, it still serves its purpose to the user. Would you prefer an inaccurate progress bar or no indication of progress at all?

    • Photo: Jane Kennedy

      Jane Kennedy answered on 15 Jun 2020:


      Great question – hard to think of something to top the video streaming answers and loading screen answers! Some other everyday examples that come to mind:

      – Search engines: to the user, these just look like a website with a text input box and a ‘go’ button. Underneath there are complex algorithms working out which sites on the whole of the world wide web are most likely to be useful for the searcher, based on the words they use. They also have to complete this huge job in a very short space of time (who wants to wait more than 5 minutes for their Google search?). This is achieved by both the best possible algorithm (not checking every website on the web for every search), and running on massive computers, however all of that is totally hidden from the user.
      – Compilers: data and programming instructions are represented in the computer’s hardware as series of high and low electric voltages. These are often thought of as series of 1s and 0s, known as binary code. Fortunately, programmers don’t write code with just 1s and 0s, that would be horrible. Compilers are special programs that translate human-readable programming languages like Java, python, or C into computer-readable binary code. Compilers can do things like spot errors, and are faster and better that a human at creating binary code, for whatever computer they are compiling on. Compilers and human readable programming languages make writing computer code quicker and easier than writing binary code directly, I’m amazed at the skill that must go into creating compilers.
      – Operating systems (OSes): think Windows, iOS, Android, macOS, Linux.. Your OS maybe doesn’t look like it’s doing very much, but it actually plays an extremely complex and important role. One thing they do is control the execution of programs or applications. It lets lots of applications run smoothly at the same time on just one central processing unit (the brain of any computer), but doesn’t let different applications interfere with each others’ data. It also handles any problems that occur when an application is running (known as “exceptions”) so if I write code with an error in it, only that program will fail and the rest of the system can keep running as normal. Finally, your OS acts as a go-between for any external devices (monitor, keyboard, mouse) and the software. This lets programmers write code that responds to mouse clicks and keyboard presses without worrying about what the hardware is doing, the OS manages the signals and gets them in a format that’s easier to use.

Comments