Object Oriented Programming

0.0(0)
studied byStudied by 3 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/32

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

33 Terms

1
New cards

What is a class?

A blueprint/template for an object which defines attributes and methods to capture the common behaviours and characteristics of the object

2
New cards

What is an object?

A particular instance of a class

3
New cards

What is instantiation?

Where an object is created using a contrsuctor

4
New cards

What is encapsulation?

Where attributes and methods are wrapped into a single entity

5
New cards

What is inheritance?

Creating a new class based on an existing class. The subclass inherits the methods and attributes of the superclass

6
New cards

What is aggregation?

A type of relationship between two class where one class has one or more instances of the other class. Using aggregation, if the containing class is destroyed the instances of the other class are not

7
New cards

What is composition?

A type of relationship between two class where one class has one or more instances of the other class. Using composition, if the containing class is destroyed the instances of the other class are also destroyed

8
New cards

What is polymorhpism?

The ability for a method to behave differently in each class in a class heirarchy

9
New cards

What is overidding?

The method through which polymorphism is achieved. This is when a method is redefined in a subclass

10
New cards

What 4 qualities are the reason the OOP paridigm is used?

It is:

1. Modular

2. Scaleable

3. Extensible

4. Reusable

11
New cards

How is OOP modular?

Details of implementation are hidden meaning they don't need to understand the code to use it. Objects control how they can be interfaced with meaning values can not be set to things that aren't possible

12
New cards

How is OOP scaleable?

It is easy to add developers and functionality to the program because the whole does not need to be understood by every programmer. It is also easier to maintain and modify code

13
New cards

How is OOP extensible?

It provides a good framework for expanding through libraries meaning it is easier to incorporate external code libraries or modules

14
New cards

How is OOP resuable?

Each object is self-contained so can easily be reused in other programs

15
New cards

What are the 3 main principles of OOP?

1. Encasuplate what varies

2. Favour composition over inheritance

3. Program to interfaces, not implemenation

16
New cards

What does 'encapsulate what varies' mean?

Any objects which change throughout your program should be wrapped up into a class and protected

17
New cards

Why should you 'favour composition over inheritance'?

Composition gives more flexibility and is more natural than attempting to find a family tree

18
New cards

What is an interface?

A collection of signatures or methods without implemenation

19
New cards

What does 'program to interfaces, not implemenation' mean and why should you do it?

Focusing on what your program does rather than how. This gives your program greater maintainablility, extensibility and testability

20
New cards

What are getter and setter methods?

Methods that allow you to get and update the attributes of an object without directly accessing those attributes

21
New cards

Why use getter and setter methods?

To prevent accidentally updating attributes in your program

22
New cards

What are access modifiers?

Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes

23
New cards

Where can public methods/attributes be accessed?

Anywhere in the program

24
New cards

Where can private methods/attributes be accessed?

Only in the class that they are defined

25
New cards

Where can protected methods/attributes be accessed?

In the class they are defined and in any subclasses

26
New cards

What does UML stand for?

Unified Modeling Language

27
New cards

What is UML used for?

To create class diagrams in order to visualise, construct and document software

28
New cards

How are public methods/attributes represented in UML?

With a + before the method/attribute

29
New cards

How are private methods/attributes represented in UML?

With a - before the method/attribute

30
New cards

How are protected methods/attributes represented in UML?

With a # before the method/attribute

31
New cards

How is inheritance represented in UML?

A line connecting the two classes with an unfilled arrow pointing to the superclass

32
New cards

How is composition represented in UML?

A line connecting the two classes with a filled diamond next to the container class

33
New cards

How is aggregation represented in UML?

A line connecting the two classes with an unfilled diamond next to the container class