1.2.4) Types of Programming Language Flashcards
What are programming paradigms?
Established conventions and practices which dictate how computers are structured and developed, offering varied methodologies for software construction.
What are the different types of programming paradigms?
- Procedural
- OOP
- Assembly
What is a procedural language?
A type of language that structures code into a series of procedures or functions that are executed sequentially.
Strenths of procedural languages
- Efficient for straight forward tasks
- Clear and obvious flow
- Easy to implement
- Step by step
Weaknesses of procedural languages
- Unwieldly for large programs (clunky)
- Lack of modularity can lead to code redundancy
- Not ideal for complex applications
- Difficult to scale
What is Object-Oriented Programming?
A type of language that organizes code around “objects” rather than functions.
Strengths of OOP
- Enhances modularity
- Enables real-world modelling
- Reusable code
- Flexible
Weaknesses of OOP
- Unnecessary complexity
- Inefficiency
- Not always applicable
- Misuse can increase complexity
What is Assembly Language?
A low level representation of machine code for a specific computer architecture.
Strengths of Assembly language
Direct control over hardware
Optimized performance
Transparent about machine operation
Potentially efficient
Weaknesses of Assembly Language
- Hard to learn
- Hardware specific so not portable
- Error prone
- Difficult to write, debug and maintain with large programs
What is the Opcode?
The binary representing the instruction
What is the Operand?
Represents location of data, varies by type of addressing
What are the different types of addressing memory?
- Immediate
- Direct
- Indirect
- Indexed
What is immediate addressing?
When asked to load 1000 it will return 8
Direct
When asked to load 1000 it will return the value stored in the memory loacation 8.
What is indirect addressing?
When asked to load 1000, it will find the value stored in the memory location 8 and then go to that memory location.
What is indexed addressing?
Starts at the memory location stored in the operand and takes every contiguous item for the index register.
What are the three sections of a class?
- Name
- Attributes
- Methods
How do you define a class in python?
class className()
How do you define an encapsulation status?
private variableName
How do you construct a class?
def __init__(self,v1,v2):
self.v1=v1
self.v2=v2
self.attribute= “something”
How do you define a method in python?
def method(self):
How to you make an object in python?
object1=className(v1,v2)
How to call a method in python?
object1.method(v1)
What is inheritance?
A mechanism in which you derive one class from another.
How to create a child class in python?
class className(parClassName)
What is Overriding?
Allows a child class to override a method provided by a parent class
How do you override a method?
Create a new method with the same function name.
What is polymorphism?
A pattern in which objects have a different functionality while sharing a common interface.
What is encapsulation?
The process of making an attribute or method public or private.
How are private attributes retrieved?
get and set methods