2.5 - Languages and IDEs
Levels of languages
- There are two levels of languages: high level, and low level.
- High level languages are easier to read, write and understand, but
are harder for computers to process and must be run through a compiler
(translates the high level language into a low level language).
- Low level languages are harder to read, write and understand, but are
easier for computers to process and do not need a compiler. Low level
languages were the first programming langauges, and programming took a
long time.
Low-Level Languages
- Low level languages either are, or resemble, machine code.
- They use 'instructions', which are commands that the CPU understand.
- Originally, programming had to be done directly in machine code.
This means that the programmer had to write the code in binary.
- Later on, assembly language was created, which is a low level language
that resembles machine code, but is easier to read and write.
- It has to be translated (through an assembler) into machine code
before it can be run on the computer, but it is very easy to predict what
will come out.
- It looks like this:
Advantages of Assembly | Disadvantages of Assembly |
---|---|
|
|
High-Level Languages
- High level languages are easier to read, write and understand, but are
harder for computers to process and must be run through a compiler.
- Languages like C, C++, Java, Python, OCR Reference Language, JavaScript,
and pretty much any 'programming language' you would use are high level.
- Despite the fact that the generate machine code may be less efficient,
this is generally not an issue due to advancements in processing power
and memory capacity.
- One 'standard library' instruction can be many machine code instructions.
Advantages | Disadvantages |
---|---|
|
|
Translators (Compilers and Interpreters)
- A translator is a program that translates source code into machine code.
- The translator required by low-level languages (such as assembly) is
called an assembler.
- The translator required by compiled high-level languages (such as C) is called
a compiler.
- The translator required by interpreted high-level languages (such as Python) is called
an interpreter.
Compilers
- Compilers translate source code into machine code before it is run.
- Compiled code can be distributed as executable files and run directly.
- If errors are found during compilation, or if any changes are made, the
entire thing will need to be recompiled, which can take a long time.
Advantages | Disadvantages |
---|---|
|
|
Interpreters
- Interpreters are programs that translate source code into machine code
during its running.
- They go line-by-line, and if any errors are found, they will stop and
display an error message.
- Programs run with interpreters are usually slower than compiled code, but they are easier
to debug.
- Interpreted code is more difficult to distribute, since it requires a runtime
environment to run, for example the Python interpreter.
Advantages | Disadvantages |
---|---|
|
|
IDEs
- An IDE, or Integrated Development Environment, is a software application
that are designed to make writing code easier and more efficient.
- There are multiple different facilites available within IDEs:
- Editors
- Error diagnostics
- Runtime environments
- Translators
Editors
- The 'editor' component of an IDE is the part that allows you to write
code.
- They will usually have syntax highlighting, which will make it easier to
read code, by highlighting key words.
Error diagnostics
- Error diagnostics are a feature of an IDE that will display error messages
when there are errors in your code.
- They will also highlight the line where the error is, and will underline
the error in the code.
- This has some overlap with runtime environments, as errors in your code #
during runtime (not detected beforehand) will be highlighted.
- This is useful for finding errors in your code, and for fixing them.
Runtime environments
- Runtime environments are a feature of an IDE that will allow you to run
your code.
- They will have the normal start-stop buttons you expect, but a decent
IDE will also have a 'debug' option, which allow you to run your code
line-by-line, and stop at any errors.
Translators
- IDEs will have built-in translators, so you can run your code without having to leave the IDE.
end of the course. woop woop