Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
21 Cards in this Set
- Front
- Back
Design principle #1
|
Identify the aspects of your code that vary and seperate them from what stays the same.
|
|
Noem enkele Desing Patterns
|
Strategy pattern
Observer pattern Decorator pattern Singleton pattern State pattern Collection pattern |
|
Encapsulate what varies?
|
If some aspect of code is changing.
By seperating out the parts of your code that vary. |
|
Design principle #2
|
Program against a interface.
|
|
Design principle #3
|
Favor composition over inheritance.
|
|
Design principle #4
|
Strive for loosely coupled designs between objects that interact.
|
|
Design principle #5
|
Classes should be open for extension but closed for modification.
|
|
Explain the open-closed principal.
One of the most important design principles. |
We want classes to be open to extensions of behaviour.
But we also want classes closed to modifcation. Our goal is to be able to easily augment what we have but without modifying existing code. |
|
Decorator Pattern
|
Attached additional responsibilities to an object dynamically.
Decorators provide a flexible alternative to subclassing for extending functionality. |
|
Singleton Pattern
|
Ensures a class has only one instance and provide a global access point to it.
|
|
Why Singleton pattern?
|
Connection and thread pools
Logging facilities Preference and registry objects Device, printer, and graphics drivers Anywhere you want to ensure a resource exists only once. |
|
Hoe ziet een Singleton Class Diagram eruit?
|
Class= Singleton
static Single instance= static uniqueInstance static method= static getInstance() |
|
What is Lazy Instanciation?
|
It insurces that only one instance of a class will ever excist.
If no object in the code ever calls tne instance method, it will never be instanciated. |
|
In wich situation the Singleton pattern fails?
|
In a multi thread situation
|
|
Wich two ways make the Singleton pattern "thread safe"?
|
Create a instance "needy instead of lazy", it will be always created.
Add the keyword synchronized to the getInstance method. |
|
The Observer pattern bestaat uit 2 objecten, welke zijn dit?
|
Publishers
Subscibers |
|
Beschrijf het Observer Pattern.
|
Defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updates automatically.
|
|
Wat zijn de objecten in een one-to-many relationship?
|
Subject
Dependent |
|
Hoe ziet het class diagram van een Subject eruit?
|
interface name= Subject
method= registerObserver() method= removeObserver() method= notifyObserver() |
|
Uit welke patterns bestaat het MVC pattern?
|
1.Observer pattern
2. 3. |
|
Op vlo staat een docuement met de aliase en de omschrijvingen vand e besproken patterns
|
check vlo allPatterns.docx
|