Programming Languages
What is a programming language?
Programming languages are used to control a computer. You have probably heard of a few... Java, C, C#, Python (although strictly python is a scripting language). There are many that you wont necessarily know. Here is a comprehensive list from Wikipedia to give you an idea.
High Level Languages
- They are closer to the English language and use English words (e.g. print, while).
- Easier and quicker for humans to write because one high level command (e.g. print) written in a low level language would require many commands. So there is less code to write.
- Easier and quicker to read and understand (and remember)!
- Easier and quicker to maintain (to debug and spot errors)
- Code is also more portable meaning that it will work with different types of computer processors.
- However, they must be translated before the can be executed by the processor.
- Examples: Python, C# and Java.
Low Level Languages
- These are difficult for humans to understand as the use mnemonics.
- They are also difficult for humans to write code because they require an understanding of the processor's structure and register.
- They are not portable. They must be written for a specific processor to understand.
- However, because they do not need to be translated so they are faster to execute.
- So they are often used to program where speed and efficiency are essential e.g. creating a game, embedded programs
Compilers and Intepreters
- Processors can not run your high level language. Processors can only understand machine code.
- High level programming langages (such as C# or Python) use compilers to convert code and compile (build) the program into something called object code. Objects are then translated into machine code. This happens in one go when you compile your program.
- An interpreter translates each line of code and runs it before moving on to the next.
- When a program is compiled or interpreted, it picks up syntax errors. These are grammar style errors in the code which will prevent it from working.
How are programs produced?
Using a Compiler to produce the program.
- Converts code into an executable in one go (e.g. HelloWord.exe) when you build the program (F7 in Visual Studio).
- It will report errors, at the end once it has finished compiling.
- This means that you can distribute the software by sending out the executable.
- This also means that the program user doesn't see the actual source code, just the executable. So they can't study or modify it.
- You can run an executable repeatedly without having to re-analyse the code.
Using an interpeter to produce the program.
- Converts code line by line and executes immediately. So no final executable is necessary.
- It will stop when it finds an error rather than wait until the end. It will then show the location of the error.
- So it is quicker than the compiler to re-interpret rather than re-compile the whole program. A compiler takes longer to analyse the source code.
Open-Source - it's a caring, sharing kind of world.
Open-source is about sharing your ideas with the world. Open-source code can be used, modified, ran and re-distributed by anyone with the know-how. Why would anyone want to be so nice after all the effort that they have invested? Check out these videos to understand more. Don't worry if you don't understand every term just get the gist!