Difference between revisions of "Classification of Programming Languages"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Procedural)
(Event Driven)
Line 72: Line 72:
  
 
==Event Driven==
 
==Event Driven==
 +
Event driven programs continuously run, the user will need to quit or exit to stop the program. You will have used these for windows form applications.
 +
 +
===Events===
 +
These are actions by the user or the system
 +
 +
===Components===
 +
reusable interface elements such as buttons, textbox, or labels etc. Events can happen to individual components.
 +
 +
===Event Loop===
 +
This is the part that continuously runs, it is designed to listen for the events programmed by the developer. Once this section is run it will be run again, and again, and again. Hence the term event loop.
 +
 +
===Trigger Functions===
 +
Trigger functions are added to the event loop for each event the program should detect. These trigger functions will be triggered when the specific event is detected.
 +
 +
===Event Handler===
 +
The trigger function will run the event handler when triggered. The event handler is therefore the code to run when the event is detected.
  
 
==Procedural==
 
==Procedural==

Revision as of 13:28, 10 June 2018

Overview

https://www.youtube.com/watch?v=yORSZkhNpZ4&index=1&list=PLCiOXwirraUDJYD-VxmztyhsDP0QM2BHW

Low Level vs High Level

https://www.youtube.com/watch?v=tl-96ZypmpQ&list=PLCiOXwirraUDJYD-VxmztyhsDP0QM2BHW&index=2

Low Level Languages

Machine Code

Machine code is the basic binary information required for a computer to perform a function. It is classified as a 1st generation programming language. Each command is binary pattern, ie 100001 might be load, or 100010 might be add or 100011 might be store.

This is essentially writing a program by coding the binary. This provides direct access to the hardware and all programs are converted to machine code at some point.

Assembly Language

Assembly language is a low level, 2nd generation programming language, purposed towards fast execution and complete control over hardware. It replaces a binary pattern with a more readable mnemonic, ie a command word.

One assembly language instruction is equivalent to one machine code instruction, and an assembler is used to convert the assembly language to machine code.

Relationship Between Machine Code & Assembly Language

One machine code instruction will create one assembly language instruction. Remember assembly language is essentially replacing a binary pattern with a command word.

Terms

Mnemonics

An identifiable text label for a particular command (rather than requiring a programmer write instructions in binary).

Source Code

The source code is a program as written by the programmer.

Object Code

The object code is generated by the interpreter, compiler or assembler.

High Level Languages

The main characteristics of a high level language are:

  • It is easier for the programmer to identify what a command does (English words)
  • High level languages need to be translated
  • One command in a high level language represents many lines of code in assembler or machine code
  • They are portable between systems
  • More straight forward to program
  • Wider variety of data structures

Imperative

Imperative, or procedural, programming languages break down processes into functions or methods, which are all given mnemonics. A single statement of an imperative language is converted to multiple machine code instructions by a language translator (such as an interpreter or compiler), which are then executed in sequence. Imperative languages are part of the 3rd generation of programming languages. Examples of imperative languages include C++, Python and Visual Basic.

Declarative

Often referred to as Fourth Generation Languages, Declarative languages allow the programmer to specify what they want to produce, without having to say how to achieve it.

For example SQL is declarative, you say what you want to select, where to select it from, and what conditions apply. The SQL server will then execute your request according to its coding and provide you with the results.

Paradigm

Object Oriented

OOP languages are based on the emulation of real world objects and their relationships and interactions with each other. The basis of object oriented programming is situated on the re-usability and conservation of large scale code/programming structures; for example, a video game makes extensive use of object oriented programming by defining complex object hierarchies, such as:

Object
Sprite
PlayableSprite
MainCharacter
EnemySprite
BossMonster
BufferMonster
StaticSprite
Block
TreasureChest

etc...

for more information see Object Orientated Programming

Event Driven

Event driven programs continuously run, the user will need to quit or exit to stop the program. You will have used these for windows form applications.

Events

These are actions by the user or the system

Components

reusable interface elements such as buttons, textbox, or labels etc. Events can happen to individual components.

Event Loop

This is the part that continuously runs, it is designed to listen for the events programmed by the developer. Once this section is run it will be run again, and again, and again. Hence the term event loop.

Trigger Functions

Trigger functions are added to the event loop for each event the program should detect. These trigger functions will be triggered when the specific event is detected.

Event Handler

The trigger function will run the event handler when triggered. The event handler is therefore the code to run when the event is detected.

Procedural

Your experience of C# is procedural, it is the process of replacing often repeating code by giving it a name for the sub routine. Then any time you wish to run the code you can simply call it by name.

Logical

Functional

for more information see Fundamentals of functional programming