16/11/2024

Before learn

Before we learn

Computer Programming Explained

Computer Programming Explained

Computer programming is the process of designing and writing computer programs. That is pretty straightforward, isn’t it?

At its most basic, you can think of programming as giving instructions to a computer to do something you want it to do – which might sound very similar to how you operate your desktop computer. Simplistically, the only difference between what you are doing now as a computer user and what you might do as a computer programmer is that the instructions are saved somewhere so they can be used over and over. As a matter of fact, if you have used macros in a software program like a word processor or spreadsheet (or countless other applications that are macro enabled) you have done computer programming of a sort.

Programs can be as simple as a set of instructions stored in a text file for doing some mundane task, like making backups of all the computer files in a folder, or as complex as something like a word processor, or the operating system that your computer uses which can require millions of lines of code. We need to understand that computers, which are generally just pieces of metal, plastic, silicon, and other materials stuck together in a way that allows them to do some amazing things that seem like thinking, can’t actually think at all. But what they can do extremely well is follow instructions. So what are these instructions, anyway? At the level that a computer understands, these have to be very precise, very detailed, and very complete step-by-step directions, and they must be in a form that the processor and other parts of the computer can understand – and that is as little electrical pulses which humans aren’t capable of emitting (at least not at this time).

In a way, you can think of a computer program like a recipe: a set of instructions that can be followed to produce a result. In the case of a recipe, the instructions are used by a human and can therefore be a bit descriptive, leaving out some of the details. For example, if a recipe instruction is to “pour the mixture into a blender and whip until frothy”, it is assuming that the human knows what a blender is, and where it is, and how to set it up, and how to use it – and also what pour means, and what frothy means, and so on. The human chef is expected to fill in the gaps. A computer can’t do this – it has no idea what anything means, except for a few very simple instructions. So the way we do this is to give the human a way to write instructions that can then be translated into something the computer can understand. The “way to write instructions” is called a programming language.

What a programming language allows us to do is to write instructions for the computer in a more or less human readable form that can then be translated into something the computer can work with. The human readable instructions are typically called (you guessed it) – code! Each line of human readable code translates into thousands of detailed computer instructions. A special program (or set of programs) is used to do this translation – each computer language has its own translators, which are called compilers or interpreters. Once the translation is done the result is stored in some form such as a file or set of files (or in computer memory in some cases), and each time the software is run, the computer will follow the instructions and (hopefully) the program will do whatever it is that it is supposed to be doing.

Although it is often imagined that you have to be a genius to be able to write useful software, almost anyone who is computer savvy and has an interest in becoming a power user can learn to program. Most software is written by average people with specialized knowledge and skills. Mastering computer programming can be a lifelong pursuit, but gathering enough knowledge and skill to be able to do useful things isn’t out of reach for anyone who knows how to use a computer and is willing to dedicate a little time… or maybe a lot of time, but still – it isn’t out of reach.