Terms Flashcards
Interface segregation principle
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.
Law of demeter
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.
Single responsibility principle
A class can only have one function, so don’t allow functions to it that are not directly implied by the name.
Liskov substitution principle
All subclasses should have all the functions of it’s parents.
Information hiding principle
You should abstract away the inner workings of a class, instead having a well designed interface.
Singleton
A class of which can only exist one at a time.
Factory method
Constructs new similarly formatted classes.
Adapter
Adepts the interface of one class for another class. It act’s as a kind of bridge.
Decorator
Extends another class, adding functions without changing the original class.
Flyweight
If you need a lot of similair classes, you can make the different classes share data that is consistently the same between them.
Iterator
A class which contains the function to iterate trough a certain list or tree.
Command
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.
Observer
Makes a kind of ‘subscription’ mechanism that waits for something to change and then notifies the class that is subscribed to the observer.
Chain of responsibility
Each class in a chain of events can choose to continue or halt the program.
Template method
A template class that can be copied by other classes that override some of the functions without changing the rest.