Summary:Languages and environments

From Higher Computing Science
Jump to: navigation, search

Low Level Language

  • Computers are digital devices, which means they only store the values 1 and 0
  • Programs and data all end up in low level form (1s and 0s) – language used to directly control a computer is called low level language or machine code.
  • Low Level Language code is very hard to read and understand
  • Low level language can be arranged into assembly code (groups of 1s and 0s are replaced with keywords to make the code easier to read)
  • Each instruction in assembly code is equivalent to 1 line of LLL

High Level Language

  • Programming computers is easier if the language used is similar to natural language (the way we communicate)
  • High Level Languages are programming languages written in an English-like language, that must be translated to machine code before a computer can use them
  • High level languages follow a strict syntax. This means that the language follows a firm set of rules about what order keywords can be used. This strict syntax allows the computer to translate the code into machine code accurately.
  • There are many HLLs, all with different areas of focus, such as web development, mobile app development or computer games development

Procedural Language

  • A procedural language is a language that consists of a sequence of commands which will be executed in a predictable order from beginning to end.
  • A procedural language can group blocks of code together using procedures
  • The sequence of instructions will be translated into machine code before the code can run

Declarative Language

  • Declarative languages are designed to run tests on data
  • Instead of a sequence of commands, declarative languages have a set of facts and rules (the knowledge base)
  • A declarative program works by sending a query to the program. This is a test that is checked against the facts and rules in the knowledge base.
  • Declarative programs do not tend to use variables and control structures like procedural language, but depend on rules to control the behaviour of the program
  • Declarative programs can edit their own knowledge base (such as adding new facts) which means they can “learn” from user interaction.

Object Oriented Language

  • Object-oriented programs are designed around objects rather than sequences of instructions
  • Each type of item used in a OO program is described using code called a class
  • A class has a list of attributes and a list of methods
  • Each class can be used as the blueprint to create an object, for example the code in a class called Square could describe the attributes and methods of a square, and each square the program uses would be created as an object
  • Objects are closed off from other areas of the program – the design of the object determines which attributes and methods can be called from other parts of the program. This is called encapsulation.
  • Each class can be used as the base code for another class, and the programmer can add on new attributes and methods. For example, the Shape class could have two subclasses called Square and Triangle.
  • Creating a subclass from an existing class is called inheritance