100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Beknopte samenvatting OO Ontwerpen III $3.23
Add to cart

Summary

Beknopte samenvatting OO Ontwerpen III

1 review
 221 views  13 purchases
  • Course
  • Institution
  • Book

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.

Preview 5 out of 34  pages

  • No
  • Besproken design patterns
  • June 7, 2018
  • 34
  • 2017/2018
  • Summary

1  review

review-writer-avatar

By: chelseacarton • 3 year ago

avatar-seller
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller jakoblierman. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $3.23. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

56326 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$3.23  13x  sold
  • (1)
Add to cart
Added