Low and High Level Languages
A high-level language lets you write instructions using words and symbols that look like English or maths. For example, you can give a variable a meaningful name and write a condition that checks whether a score is above a target. This makes programs easier to learn, write, read, understand and debug than low-level code. The processor cannot run these statements directly; they need translating first.
High-level languages provide data structures such as arrays and records, so you can store and organise groups of values without building the storage yourself. They also provide libraries: ready-made subprograms and tools for tasks such as generating random numbers, doing maths or drawing graphics. Using these speeds up development because you reuse tested code instead of writing every detail. Some high-level languages are designed for a particular type of problem, and many include features that make solving problems easier.
import random
prices = [3, 5, 2]
discount = random.randint(1, 3)
total = 0
for price in prices:
total = total + price
print(total - discount)Output:
8In this program the list holds the prices, the random library supplies the discount, and a loop adds the prices together. The statements are short and readable, and the list and library save the programmer time.
High-level source code must be translated into machine code, object code or executable code by a compiler or interpreter. One statement usually becomes several machine-code instructions. For instance, a condition that tests whether a total has gone past a limit can become a fetch of the total, a fetch of the limit, a comparison of the two, and a jump to another part of the program when the test is true. High-level code is machine-independent (portable): the same source code can run on different processors with few or no changes, provided a suitable translator exists. Different processors need different translators, but the source code itself often stays the same. These benefits make high-level languages a common choice for application software, where faster development and easier maintenance matter.
Edexcel GCSE Computer Science · Low and High Level Languages