1.2.4 object orientated programming Flashcards

1
Q

Programming paradigms

A

different approaches to using a programming language to solve a problem

Split into two categories:
Imperative and declaritive
which then can get broken down specific paradigms. The paradigms used depends on the type of problem that needs to be solved.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Imperative

A

a programming paradigms that uses code that clearly specifies the actions to be performed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Procedural programming

A

procedural specifically describes a language used to write programs that can be split into procedures (or subroutines). This type of programming uses a sequence of instructions, often contained within
procedures. These instructions are carried out in a step-by-step manner.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

High-level language

A

High-level languages are programming languages that are designed to allow humans to write computer programs and interact with a computer system without having to have specific knowledge of the processor or hardware that the program will run on.

High-level languages use command words and Syntax which reflects everyday language, which makes them easier to learn and use. High-level languages also offer the programmer development tools such as libraries and built-in functions.
One big advantage of high-level languages over low-level languages is that they have built-in functions for programmers to use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Object-orientated programming

A

Object-oriented languages are built around the idea of reusable classes. A class is a
template for an object and defines the state and behaviour of an object. State is given by
attributes which give an object’s properties. Behaviour is defined by the methods associated with a class, which describe the actions it can perform.

Classes can be used to create objects by a process called instantiation. An object is a
particular instance of a class, and a class can be used to create multiple objects.

Getters and setters (also known as accessors and mutators) are special methods that exist to get the value of an attribute and to set or change the value of an attribute.

Encapsulation binds together the attributes (data) and the methods (functions and procedures) that manipulate the data. It does this so that the data is protected.
attributes are declared as private so can only be altered by public methods.

Abstraction The complexities of how the object works are hidden.

inheritance.
When a class inherits from another, the subclass will possess all of the methods and attributes of the superclass and can also
have its own additional properties. This feature of OOP allows programmers to effectively reuse certain components and
properties while making some changes.

Polymorphism is a property of OOP that means objects can behave differently depending on their class. There are two
categories of polymorphism: overriding and overloading. Overriding is redefining a method within a subclass and altering the code so that it functions differently and produces a different output. Overloading is passing in different parameters into a method. Polymorphism is the ability of the system to process objects differently depending on their data type or class. The ability of an object to take on many different forms; specifically for a method with the same name to have many different implementations.

Advantages
- OOP allows for a high level of reusability, which makes it useful for projects where
there are multiple, similar components.
- Classes can also be used across multiple projects.
- Encapsulation makes the code more reliable by protecting attributes from being
directly accessed.
- OOP requires advance planning and a thorough design can produce a
higher-quality piece of software with fewer vulnerabilities.
- The modular structure used in OOP makes it easy to maintain and update.
- Once classes have been created and tested, they can be reused as a black box
which saves time and effort.

Disadvantages
- This is a different style of programming and so requires an alternative style of
thinking.
- OOP is not suited to all types of problems and can sometimes produce a longer,
more inefficient program.
- Generally unsuitable for smaller problems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly