Terms Flashcards

1
Q

Interface segregation principle

A

This principle tries to prevent unneeded functions to be passed to subclasses. It means that we shouldn’t just put all the functions in the over arching function.

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

Law of demeter

A

Only functions that a class can call are from the class itself, a class that is passed as parameter, objects the class created, direct component objects.

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

Single responsibility principle

A

A class can only have one function, so don’t allow functions to it that are not directly implied by the name.

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

Liskov substitution principle

A

All subclasses should have all the functions of it’s parents.

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

Information hiding principle

A

You should abstract away the inner workings of a class, instead having a well designed interface.

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

Singleton

A

A class of which can only exist one at a time.

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

Factory method

A

Constructs new similarly formatted classes.

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

Adapter

A

Adepts the interface of one class for another class. It act’s as a kind of bridge.

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

Decorator

A

Extends another class, adding functions without changing the original class.

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

Flyweight

A

If you need a lot of similair classes, you can make the different classes share data that is consistently the same between them.

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

Iterator

A

A class which contains the function to iterate trough a certain list or tree.

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

Command

A

Seperate a function from the class that will eventually invoke the function. This means it can be used by different classes and it seperates concerns.

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

Observer

A

Makes a kind of ‘subscription’ mechanism that waits for something to change and then notifies the class that is subscribed to the observer.

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

Chain of responsibility

A

Each class in a chain of events can choose to continue or halt the program.

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

Template method

A

A template class that can be copied by other classes that override some of the functions without changing the rest.

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

Visitor

A

Remove algorithms in a class from that class, stops bugs and you seperate the concerns.