This post is part of the series A Complete Beginner’s Guide To Hacking
How A Computer Works
Ultimately your computer is a series of tiny electronic switches called transistors. Like most switches, they are binary, which means they can be one of two options – ON or OFF. You could also write this as 1 or 0. You can therefore send a series of signals between these transistors which can communicate messages in a binary language – for example “0100” means the number 4 but “0010” means 2.
We design the electronics in such a way that we can manipulate these signals to do processes like addition. Therefore we can make it such that certain combinations of the binary signals trigger these actions. We call these combinations machine code and it is unique to the particular processor design – i.e. what the machine code combinations are depends on how you have designed the electronics that carries out the processes.
We can then design processes that take certain combinations of inputs in a more friendly form and translates them into this machine code. For example if I type ADD into a bit of the machine then the electronics that results in outputs the combinations of bits in machine code for addition. This translation process from a friendlier code input to machine code is done by what’s called an assembler. The friendlier language itself is called assembly code and is often in the format of what’s called ‘opcode’ with short phrases like ADD, and with the numbers written in hexadecimal format. We can save design the electronics to store signals in memory so we can store combinations of code in a piece of memory which are generally numbered so that if we use that number it refers to that piece of memory.
All these “low level” codes will be interpreted differently by different machines depended on their innate electronics design.
Higher Level Languages
So, finally we get up to the top, high level languages. These are the languages that most programmers, developers, hackers, computer scientists use – and generally what you will be looking to learn. These are written in phrases and structures more similar to natural languages and are far more intuitive to use.
These work by having developed combinations of the lower level codes that can be stored in your computer’s memory that “translate” the high level languages into new combinations of lower level codes suited to your device. The programs that do this are often (but not always) compilers – you will learn more about these later in the guide. As long as as you have the relevant program to your language and device to translate for you, you will probably never have to see any lower level languages. But it is important (and I think interesting) to understand how the whole thing works.
Of these there is a huge array of different high level languages that have been developed – C, Haskell, Python, HTML, Perl are names of a few but there are hundreds out there. Which one you learn depends on what it is you want to do – they have been designed to suit different purposes.
- If you want to build a website or any sort of web application then there are an several languages you need to understand and I have written the next chapter in this guide on just those.
- For scientific applications, developing models for simulation and calculation purposes, generally you are looking for Object-Oriented Languages like Python and Java. Personally I find that Python offers the most support and resources for scientific applications and is generally considered easier to learn so is more suited to someone that is looking to program just for a specific purpose.
- To get started in general interest in computer science then a language like C will generally teach you good habits for programming and will make you develop a better understanding of how your computer works
Have a look around online and ask around to find out what it is you should learn in your case.
NEXT: Website Languages