Mark As Completed Discussion

Definition

When we ask ourselves a question such as what computer programming is, it's tempting to just look up the definition. We all sort of know what it is, but we want to get it precisely right. Let's not do that this time - let's build the definition from scratch.

So, if you were to ask a layman what programmers do, they might say that they make computers do stuff. This is certainly true! You interact with a computer and make it perform some tasks you wanted to get done. But that's not a good enough definition, because that would make any old bloke just using existing programs a programmer.

Definition

What that definition is missing is the how. The difference between a programmer and any other user of computer software is that a programmer is making the computer do stuff by writing code. This is still not good enough, however. We might be getting into some nuance, but there are types of code that aren't programs, such as markup languages.

We've arrived at the question of what kind of code do programmers write. And the answer to that is programs that can be executed, which result in certain commands being run on the central processing unit, that can be converted to machine code. So that should about encompass our definition? Uh, not quite.

Another very important consideration is that writing code is just a part of programming. That code has to be made up first! It might sound like a silly complaint about our definition - of course, we have to think of something before writing it down. But the thing is, in computer programming the code we write has a lot of theory behind it. There are good and bad ways to write code and there's a lot of computer science theory behind how to do it well. So you have to also know how to design code, to think up systems and algorithms that will do a good job, that other people will be able to read and maintain, that will execute quickly, be bug-free, testable, provable, optimal.

And now we're ready to formulate our definition.

Computer programming is the process of designing and writing code that can compile into an executable program that does a specific calculation or another task.

Why this long-winded way of deriving that definition? Because this is exactly the type of thinking that makes a good programmer - thorough, analytical, iteratively building upon previous work, precise, able to pull a concept one knows from practice apart, and then put it back together in a formal sense. This approach to information, even when it seems trivial, is going to help you notice gaps in your knowledge and understanding - or indeed bugs in your code - much quicker.

Let's test your knowledge. Fill in the missing part by typing it in.

Computer programming is the process of designing and writing code that can compile into an ____ program that does a specific calculation or another task.

Write the missing line below.

How does it work?

While our definition is good, you probably want to understand what this process looks like in a little bit more detail. How do we actually make computers do stuff we want?

We do that by writing commands for them in programming languages. Unlike natural languages, which are usually very flexible in their structure and word order, programming languages are written languages with a very strict syntax. A programmer who learns this syntax will be able to use it to write commands for basically anything.

How does it work?

But the thing is, computers don't understand the syntax programmers use. Computers only understand so-called machine language, a set of instructions hard coded into the hardware itself. There are very simple instructions, like "move this bit from this memory location to that memory location" or "add this number to the number on this memory location." The problem is, it would be very difficult to write a complex program if we had to use a language that needed our precise instructions for operating on memory like that. We would be repeating ourselves all the time and having to write lines and lines of code to simply compute one equation.

Instead, we use compilers. Compilers are programs that translate from the higher programming language that the programmer is using into machine code that the computer understands. These translation tools are the foundation on which the entire IT industry relies.

Compiled programs (executables) are usually thoroughly tested for any errors or unexpected behaviors.

Algorithms

We now know that to make a computer do stuff, we need to write a specific series of instructions for it in a way that can be translated into something it understands.

An algorithm is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of specific problems or perform a computation.

Let's explain various parts of this definition:

  • finite sequence means that the algorithm can be expressed in a finite number of steps, though these steps may repeat infinitely;

  • well-defined means that each step is defined precisely, unambiguously;

  • computer-implementable means that an algorithm doesn't have to be written in a programming language, but we have to be capable of writing it in it - a process called implementation;
  • performing a computation is calculating a value of a certain equation, such as 1+2; and
  • to contrast that, solving a class of specific problems would be creating an algorithm to address a more general case, such as x+y.

Algorithms are always technically deterministic because they produce the same output for the same input. Some people call algorithms that include randomness non-deterministic because they give an illusion of non-determinism, but the truth is they also rely on inputs (seeds) for their random number generators. These seeds can be system times or something else, but if we used all the same seeds multiple times we'd get the same result.

Algorithms

Applications of Computer Programming

Computer programs are everywhere.

The obvious examples are programs run on general-purpose computers, which are what you probably recognize as a computer. That would be your PCs (laptop or desktop), smartphones, modern consoles, server machines, and even supercomputers. They're called general purpose because, well, they can be used for any purpose. You can run a video game, open your browser to read this article, run any application you've installed or otherwise obtained an executable version of, or you can write your own applications for them.

There are also special-purpose computers. They sacrifice some of the general applicability of general-purpose computers in favor of speed and efficiency. They often implement the kinds of logic their particular application needs most often at the hardware level - making those types of operations insanely fast compared to running the same operation on a general-purpose computer. These types of computers may be applied in the automotive industry, robotics, satellites, routers, navigational systems, digital watches, etc.

Programming for these devices happens on many levels:

  • Frontend - the interactive part of the program that the end-user sees;
  • Backend - the logic executing behind the scenes, sometimes on a remote server;
  • Networking - connecting multiple computers so that they could synchronize tasks or data;
  • Databases - finding efficient ways to reliably store and easily recover data;
  • Data Science - studying patterns that can be found within data and then perhaps applied to real-world problems;
  • Artificial Intelligence - creating algorithms that explore a search space efficiently through using heuristics or imitating human thinking;
  • Security - working to prevent hackers from exploiting flaws in the design of a program;
  • Dev Ops - making everyone's work efficient by automating important processes, providing useful tools, scripts, etc.
  • Quality Assurance - a robust process of software testing and verification, through manual testing, automated testing, and sometimes formal proof of function;
  • etc.

This is by no means an exhaustive list. There are many more fields and types of specializations programmers can have. The point is that it is a vast industry and a lot of people do highly specialized jobs within it. As said, everything around us needs programming nowadays, and no one person could do it all well.

Build your intuition. Fill in the missing part by typing it in.

An algorithm is a finite sequence of well-defined, computer-implementable ____, typically to solve a class of specific problems or perform a computation.

Write the missing line below.

Try this exercise. Click the correct answer from the options.

Algorithms are definitely non-deterministic if they...

Click the option that best answers the question.

  • ...produce the same output for different inputs.
  • ...include random variables.
  • ...produce different outputs for the same inputs.
  • ...produce the same output for the same input.

One Pager Cheat Sheet

  • Computer programming is defined as the process of designing and writing code that is compiled into an executable program to perform a specific task or calculation, highlighting the aspects of analytical thinking, iteration, precision and comprehensive understanding involved in becoming a proficient programmer.
  • Computer programming involves the designing and writing of code that is then compiled into a machine-interpretable language through a compilation process, resulting in an executable program to carry out specific tasks.
  • Programming languages are used to write commands for computers, but since computers only understand machine code, these commands are translated into machine code by programs called compilers, a crucial component of the IT industry.
  • An algorithm is a finite sequence of well-defined, computer-implementable instructions designed to perform a computation or solve a specific class of problems, and although they are deterministic because they produce the same results with the same inputs, some, which use random number generator seeds, are known as non-deterministic.
  • Computer programming is applied in a wide array of contexts, from general-purpose computers like PCs and smartphones, to special-purpose computers used in industries such as automotive and robotics, with specialized roles including Frontend, Backend, Networking, Databases, Data Science, Artificial Intelligence, Security, Dev Ops, and Quality Assurance.
  • An algorithm is a finite sequence of well-defined, computer-implementable instructions that operate within a computer's capabilities to solve a class of specific problems or perform computations, with each instruction being critical for achieving the desired result.
  • In computing, an algorithm is a set of instructions for a specific task, with a deterministic algorithm producing predictable outputs based on set rules, while a non-deterministic algorithm can produce varying outputs due to potential multiple execution paths.