100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Beknopte samenvatting OO Ontwerpen III

Rating
5.0
(1)
Sold
13
Pages
34
Uploaded on
07-06-2018
Written in
2017/2018

Zeer beknopte samenvatting van alle design patterns met kleine uitleg. Inclusief klassendiagrammen en voorbeelden uitgewerkt in code. Ideaal om voor het examen eens te herhalen.

Institution
Course












Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Institution
Study
Course

Document information

Summarized whole book?
No
Which chapters are summarized?
Besproken design patterns
Uploaded on
June 7, 2018
Number of pages
34
Written in
2017/2018
Type
Summary

Subjects

Content preview

OO ONTWERPEN III
Academiejaar 2017 - 2018




Jakob Lierman
HoGent

,Jakob Lierman OO Ontwerpen III


Inhoud
INLEIDING .................................................................................................................................................. 4
CREATIONAL PATTERNS .............................................................................................................................................. 4
BEHAVIOR PATTERNS ................................................................................................................................................. 4
STRUCTURAL PATTERNS .............................................................................................................................................. 4
FACTORY PATTERN ..................................................................................................................................... 5
FACTORY METHOD .................................................................................................................................................... 5
UML Diagram ................................................................................................................................................... 5
Ontwerpprincipe .............................................................................................................................................. 5
Code ................................................................................................................................................................. 5
ABSTRACT FACTORY ................................................................................................................................................... 6
UML Diagram ................................................................................................................................................... 7
BUILDER PATTERN ...................................................................................................................................... 8
UML DIAGRAM ........................................................................................................................................................ 8
CODE ...................................................................................................................................................................... 8
VOORDELEN ........................................................................................................................................................... 10
GEBRUIK EN NADELEN .............................................................................................................................................. 10
FLUENT VARIANT ..................................................................................................................................................... 10
SINGLETON PATTERN................................................................................................................................ 12
UML DIAGRAM ...................................................................................................................................................... 12
CODE .................................................................................................................................................................... 12
MULTITHREADING OPLOSSINGEN................................................................................................................................ 12
Zonder lazy loading ........................................................................................................................................ 12
Met lazy loading............................................................................................................................................. 13
TEMPLATE METHOD ................................................................................................................................. 14
UML DIAGRAM ...................................................................................................................................................... 14
CODE .................................................................................................................................................................... 14
COMMAND PATTERN ............................................................................................................................... 17
UML DIAGRAM ...................................................................................................................................................... 17
CODE .................................................................................................................................................................... 17
MACRO-COMMAND................................................................................................................................................. 19
UML Diagram ................................................................................................................................................. 19
Code ............................................................................................................................................................... 19
ITERATOR ................................................................................................................................................. 21
UML DIAGRAM ...................................................................................................................................................... 21
CODE .................................................................................................................................................................... 21
COMPOSITE PATTERN ............................................................................................................................... 23
UML DIAGRAM ...................................................................................................................................................... 23
CODE .................................................................................................................................................................... 23
NULL ITERATOR ....................................................................................................................................................... 25
COMPOSITE ITERATOR .............................................................................................................................................. 25
ADAPTER PATTERN ................................................................................................................................... 27
UML DIAGRAM ...................................................................................................................................................... 27
CODE .................................................................................................................................................................... 27

2

,Jakob Lierman OO Ontwerpen III


PROXY PATTERN....................................................................................................................................... 29
UML DIAGRAM ...................................................................................................................................................... 29
CODE .................................................................................................................................................................... 29
REMOTE PROXY (RMI)............................................................................................................................................. 30
VIRTUAL PROXY ...................................................................................................................................................... 31
DYNAMIC PROXY ..................................................................................................................................................... 32




3

,Jakob Lierman OO Ontwerpen III



Inleiding
Creational Patterns
- Factory method
- Abstract factory
- Builder
- Singleton

Behavior Patterns
- Template method
- Command
- Iterator

Structural Patterns
- Composite
- Adaptor
- Proxy




4

, Jakob Lierman OO Ontwerpen III



Factory Pattern
Voorbeeld: pizzeria.

Factory Method
Het factory method pattern definieert een interface voor het creëren van een object, maar laat de
subklassen beslissen welke klasse er geïnstantieerd wordt. De factory method draagt de instantie
over aan de subklassen.

UML Diagram




Ontwerpprincipe
Dependency inversion principe:

- Wees afhankelijk van abstracties
- Wees niet afhankelijk van concrete klassen

Het principe suggereert dat onze high-level componenten niet afhankelijk mogen zijn van onze low-
level componenten. Beiden zouden moeten afhangen van abstracties.

Code
public interface PizzaIngredientFactory {
public Dough createDough();
public Sauce createSauce();
public Cheese createCheese();
}

public class BinfPizzaIngredientFactory implements PizzaIngredientFactory {
public Dough createDough() {
return new ThinCrustDough();
}

public Sauce createSauce() {
return new MarinaraSauce();
}

public Cheese createCheese() {
return new ReggianoCheese();
}
}

public abstract class Pizza {
private Dough dough;

5

Reviews from verified buyers

Showing all reviews
4 year ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
jakoblierman Hogeschool Gent
Follow You need to be logged in order to follow users or courses
Sold
256
Member since
8 year
Number of followers
136
Documents
42
Last sold
8 months ago
Samenvattingen Toegepaste Informatica HoGent

Bevat samenvattingen voor alle vakken (waarvoor een samenvatting nuttig is) uit de richting Toegepaste Informatica.

3.8

49 reviews

5
9
4
22
3
16
2
1
1
1

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions