1.2.4 Types Of Programming Language
No description yet. This curated deck is ready for daily study.
Card preview (19)
Programming paradigms
• are different approaches to using a programming language to solve a problem • can be imperative or declarative
Imperative languages/programming
• uses code that clearly specifies the actions to be performed step by step • uses statements that change a programs state e.g in the form of sequence selection etc
Declarative programming
• states the desired result and the programming language determines best how to obtain the result • eg. Functional programming
Procedural programming/language
• an imperative paradigm • breaks a solution down into subroutines • programs are written as a sequence of instructions to be executed • instructions are excecuted in a step by step manner • are easy to write and interpret
Assembly language
• Low level mnemonic representation of machine code that is computer architecture/processor specific • uses mnemonics which are abbreviations/ sequences of letters that are easy to remember e.g ADD for addition [1] • each line in assembly language is equivalent to one line of machine code
Modes of addressing
• machine code instructions are made up of an opcode and operand • addressing mode specifies how the operand should be interpreted
Opcode
• is part of the instruction and indicates what to do (as well as the addressing mode)
4 modes of addressing
• immediate addressing • direct addressing • indirect addressing • indexed addressing
Immediate addressing
• the operand is the actual value upon which the instruction is performed • the operand is part of the instruction
Direct addressing
• the value of the operand is a reference to the address in memory where the required value is located
Indirect addressing
• the operand gives the address of a register which holds another address where the data is located
Indexed addressing
• an index register is used which stores a certain value. • The address of where the data is located is determined by adding the operand to the contents of the index register • used to access data stored contiguously in memory eg. In arrays
Why are addressing modes used?
• addressing modes allow for a much greater number of locations for data to be stored in, as the size of the operand would otherwise limit the number of addresses that could be accessed
Class
• acts as a blueprint/template for creating objects with specific attributes and methods [1] • classes provide a way to organise code in a modular way [1]
Object
• a particular instance of a class with its own unique values and properties
Methods
• are functions associated with objects or classes that define the actions an object can perform
Function
• performs a task and must return a single value
Procedure
Performs a task but does not have to return a value
Constructor method
• a special method within a class that is automatically called when an object of that class is instantiated • used to create an instance of an object from a class [1]