1.2.4 Types of programming language
No description yet. This curated deck is ready for daily study.
Card preview (24)
What is a programming paradigm?
“To describe an example of a way of doing things.” Software written using programming languages.
Why do we need different programming paradigms?
-some problems are better suited to being solved using certain paradigm
What does Turing complete mean?
-Turing complete languages can solve all the problems that a computer is able to solve -Most programming languages in most programming paradigms are said to be Turing complete
Low level: machine code
-programs directly in 1s and 0s -least abstract
Low level: assembly language
-uses mnemonics -one to one relationship -written in assembly language and translated by an assembler
High level language:
-each instruction could be many lines of machine code -HLL fit into two categories imperative and declarative
What are imperative languages?
-use statements that change a program’s state in the form of sequence, selection, iteration, etc -procedural programming is a type of imperative programming -OOP paradigms are a modern extension of the imperative programming
What are declarative languages?
-focus on whatthe program should accomplish
Advantages of machine/assembly:
-Assembly has the same efficiency of execution as machine due to its one-to-one nature -provides direct access to system features without having to go through a software interface -this improves the speed of the program
disadvantages of machine/assembly:
-code can be difficult to understand so it is hard to modify and maintain -code can be tedious to write and very prone to bugs
Features of procedural languages:
-focus on telling a computer exactly what to do by way of step-by-step instructions -Blocks of code identifyset tasksthat need to be completed using procedures and functions -need to be able to read, trace, amend and write this code
Concepts of procedural languages: (spec doesn’t specify)
-pre defined functions -local/global variables -parameter passing -modularity -procedures -library
What is LMC?
-LMC is a conceptual computer often used in education theory and exams to help students learn, test and understand assembly language -The instruction set contains 11 mnemonics
What are the 11 mnemonics?
What are the addressing methods? (4)
-direct -indirect -immediate -indexed
Why do we have different address methods?
-By utilizing different addressing modes, the operand can take on different meanings
Direct addressing:
-The value in the address is a reference to the address in memory where the required value is located
Indirect addressing:
-the value in the address part of the instruction is a reference to the address in memory where the required value is located (use instruction to find address, use value to find next address = value found)
Immediate addressing:
-the value in the address is actually the value to be used
Indexed addressing:
-There is an index register (IR) that is set to 0 -The address of the operand is determined by adding the operand to the index register
What is object-oriented programming?
-attempts to capture or group information, data and related functionality (code) into structured items known as objects
Classes vs objects:
-a class is a template of an object, containing methods and attributes -an object is an instance of a class
What is instantiation?
-The process of creating an object from a class template
What is a constructor?
-a special method within the class that runs when an object of that class type is created -When the object is instantiated the constructor method takes the values of the parameters passed into the object and sets its local attributes to their initial values