• Question: What is the most complicated computer code?

    Asked by Thomas to Michael S, Martin M, Kirsty R, David M, Cliff W, Bruno Silvester L, Barbara, Alexander DB on 15 Feb 2024.
    • Photo: Kirsty Ross

      Kirsty Ross answered on 15 Feb 2024:


      It depends on whether you are talking about complicated computer languages, or specific pieces of complicated code. Coding languages can vary in terms of how easy they are to learn.

      https://techreviewer.co/blog/the-easiest-and-hardest-programming-languages-to-learn

      Code can also vary massively in size, depending on what it is designed to do. For example, the number of lines of code in a programme can be meaningless. Some of those lines may be blank, to enable the programmer to more readily spot errors or make it easier to read. Some of those lines may be explaining the purpose of the code to a human, and won’t ever be read/implemented by the computer. Google has about 2 billion lines of code in it and high end cars can have 100 million.

      https://interestingengineering.com/lists/whats-the-biggest-software-package-by-lines-of-code

      However, computers are literal and will do what you tell them to do. A single ‘0’ in the wrong place can wreck things.

      https://www.bbc.com/future/article/20160901-the-tiny-bits-of-code-that-can-wreck-computers

    • Photo: Cliff Williams

      Cliff Williams answered on 16 Feb 2024:


      I agree with Kirsty and would add just a few more points.

      What may be complicated code to humans is really just a set of instructions to a computer. The instructions will simply run or through up an error.

      As Kirsty explains computer are literal and will do EXACTLY what you ask them, however stupid it may be. This means that in practice most computer applications have the majority of their code written to deal with potential problems, or misinformation. If we didn’t put in all this additional ‘error handling’ code, then the applications would be for ever crashing. So, for many applications, it is the error handling code can be far more complicated that the solution it is trying to achieve.

      Kirsty gave some very good examples of why the number of lines in a piece of code may not be an good indication of its complexity but there are others. One very powerful tool that computer programmers can make use of is recursion. Simply put recursion can be defined as a way of solving a computational problem by calling and solving a smaller version of the problem. In practice it often means calling a functions several times to solve the same function. Using recursion the number of lines needed to solve a complex problem can often be significantly reduced.

    • Photo: Bruno Silvester Lopes

      Bruno Silvester Lopes answered on 16 Feb 2024:


      No idea 😀

    • Photo: Barbara Shih

      Barbara Shih answered on 18 Feb 2024:


      If you meant code itself, it would be hard to judge – you can have a very complicted and badly written piece of code, or you can have well-written code that is relatively understandable but do very complicated tasks.

      If you meant the coding language, I find the less information and examples there are, the harder it is to learn the language. The group of coding languages referred to as esoteric programming language would probbaly be the most complicated to learn, as they’re not designed for usability (and sometimes they are designed for exactly the opposite of usable).

    • Photo: Martin McCoustra

      Martin McCoustra answered on 19 Feb 2024:


      I think I agree with the other scientists. It isn’t really about the complexity of the code but more about whether the code is correct. That’s why amending code like Windows without very careful thought can cause more problems than it cures.

    • Photo: Alexander De Bruin

      Alexander De Bruin answered on 20 Feb 2024:


      there’s several levels to answering this question. There are some languages that are hard to learn, but that’s quite subjective and some people may find learning any coding language easy or impossible! Even widely used languages like C++ are quite tricky to master. There are lots of intricate codes found in video games, as they’ve got to calculate physics and give the non-player characters some form of “artificial intelligence”.
      The joke answer to this is that the most complicated code is somebody else’s!

    • Photo: David McGonigle

      David McGonigle answered on 21 Feb 2024:


      The specialists in this field have given great answers: as a non-specialist, but as a neuroscientist who has to deal with pieces of computer code that generate experiments, analyse data etc… I would say that the most complicated pieces of code, in any language, are those that are not well commented and presented.

      Even someone like me can get a ‘gist’ of how code works if the writer has included enough comments – and also structured their code nicely so that it’s clear how the ‘path’ from input to output works. I have literally spent DAYS with other peoples’ code, trying to work out what the heck it’s trying to do… So Alexander’s answer is not so much of a joke, more like a quote:

      ‘Hell is other people’s code’…

      Dave

    • Photo: Michael Schubert

      Michael Schubert answered on 29 Feb 2024:


      Code can be as simple or as complicated as it needs to be to do its job! Of course, you can also write code that is more complicated than it needs to be, just like you can write sentences that are more complicated than necessary. The best code is always as simple as possible (while doing its job) and well-annotated (which means that other people can look at your notes and understand why you’ve written the code the way you have).

Comments