1.2 Software and software development Part 2 Flashcards
1.2.4 (a) Paradigm
To describe an example of a way of doing things
E.g. Functions, Variable, Loops
Turing Complete: Can solve all problems that a computer is able to solve
Some problems are better suited to being solved using a certain paradigm
1.2.4 (a) Low Level Languages
Machine Code
Assembly Language
1.2.4 (a) Machine Code
Least abstracted, closest to what actually happens on a computer
Programs are in ones and zeros
Match high (1) and low (0) electric signals
1.2.4 (a) Assembly Language
Uses code words (mnemonics)
Mnemonics match specific sequences of machine ones and zeros
In a one - to - one relationship
Translated by an assembler
1.2.4 (a) High Level Languages
First one was Fortran
One to many relationship
Each line of code is many lines of machine code
Imperative: Statements that change a program’s state through sequence, selection and iteration
Consists of commands for a computer describing how a program operates
Declarative: Focus on what the program should accomplish
1.2.4 (a) Imperative Languages
High Level Languages
Procedural Programming: Program is built from one or many sub-routines
Object-Oriented Programming: Focus on a modular approach to programming
1.2.4 (a) Advantages of Low-Level Code
Both as efficient as each other (1 - to - 1 relationship)
Produce precise optimised and efficient code
Provides direct access to system features without a software interface, improving speed
Complete control over code
1.2.4 (a) Disadvantages of Low-Level Code
Machine dependant, not portable
Difficult to write efficient assembly code
Tedious and Prone to bugs when writing code
Difficult to understand modify and maintain
1.2.4 (a) Procedural: Features, Data, Structure
Features: Sequence, Selection, Iteration
Data: Local / Global Variables, Parameter Passing
Structure: Procedures, Functions, Procedure Calls
1.2.4 (a) OOP: Features, Data, Structure
Features: Sequence, Selection, Iteration, Inheritance, Objects, Classes, Encapsulation
Data: Attributes concealed via encapsulation
Structure: Classes, Methods, Instances, Based on Models or Behaviours
1.2.4 (b) Procedural Languages
Tell a computer what to do through step-by-step instructions
Use sequence, selection, iteration
Code is developed using modules
Blocks of code identify tasks that need to be completed - Use Procedures and Functions
1.2.4 (c) Assembly Languages
First languages were machine code e.g. ENIAC
Assembly Languages are easier to program with
Substitutes binary code with mnemonics
Directly translated by an assemblers
Use Little Man Computer With 11 Mnemonics
1.2.4 (c) Little Man Mnemonics
1(Opcode) ADD: Add
2 SUB: Subtract
3 STA/STO: Store
5 LDA: Load
6 BRA: Branch Always
7 BRZ: Branch if zero
8 BRP: Branch if positive
9 INP: Input
9 OUT: Output
0 HLT: Halt Program
DAT: Data Location
4 : Returns an Error
1.2.4 (c) Little Man Computer Structure
Label Mnemonic Physical Data
Num1 DAT
ADD Num1
Labels Indicate Location
Mnemonics Represent Instruction (1st bit of data)
1.2.4 (c) Little Man Computer Execution
Follows the FDE cycle
The PC increments each time
Instructions are loaded into RAM locations
1.2.4 (d) Addressing Modes
Immediate
Direct
Indirect
Indexed
1.2.4 (d) Immediate Addressing (Immediate Operand)
The value in the operand is the value to be used
The memory does not need to be searched to find the required value
1.2.4 (d) Direct Addressing
The value in the operand is a reference to the address in memory where the required value is located
1.2.4 (d) Indirect Addressing
The value in the address part of the instruction (operand) is a reference to a memory location that contains the address in memory where the required value is located
Means larger address ranges can be used to reference data and instructions
Larger memory addresses can be accessed
1.2.4 (d) Indexed Addressing
Index Register is set to 0
First value is taken from the operand + 0
Index register is incremented by one
Same instruction is used again with the operand + 1
Address of element 0 in the operand increments
must be stored in contiguous memory locations
1.2.4 (e) OOP
Object Oriented Programming
Captures / Groups information, data and functionality into structured items know as objects
Using OOP, the world is viewed as a collections of objects
Objects are responsible for their own data and the operations preformed on that data
Objects send and receive messages to interact
1.2.4 (e) Methods and Attributes
When objects are put into classes
They have a class name
They contain Attributes (Variables) - All the information shared by any object of the class
And Methods (Subroutines) - Code associated with the class that allows you to access or change it’s attributes
1.2.4 (e) Classes
A template to make all objects of a class, look the same
An object is an instance of a class
Class can be re-used for multiple objects of the same class
Creating an instance of a class using the keyword new
1.2.4 (e) Instantiation
The process of creating an object from a class template
Object exist in memory with a copy of attributes and methods from the class template
Use the dot (.) Notation to call different methods of that particular object