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

Samenvatting ASD2

Rating
-
Sold
-
Pages
19
Uploaded on
26-07-2024
Written in
2023/2024

Met deze samenvatting een 16/20 gescoord. Voorbeelden komen beide uit de les en van andere bronnen. Bevat elk design pattern dat in ASD2 voorkomt.

Institution
Course










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

Written for

Institution
Study
Course

Document information

Uploaded on
July 26, 2024
Number of pages
19
Written in
2023/2024
Type
Summary

Subjects

Content preview

ASD2 Samenvatting
Design Patterns........................................................................................................................... 2
Factory Method (Creational).................................................................................................... 2
Abstract Factory (Creational)...................................................................................................3
Builder (Creational)..................................................................................................................4
Zonder director...................................................................................................................4
Met director........................................................................................................................ 4
Singleton..................................................................................................................................6
Eager loading (Multithreading)...........................................................................................6
Lazy Loading (Multithreading)............................................................................................6
Enum Singleton (Multithread safe).....................................................................................6
Iterator & Composite (Behavioral)........................................................................................... 7
Command (Behavioral)............................................................................................................8
Template Method (Behavioral).................................................................................................9
Adapter (Structural)............................................................................................................... 10
Proxy (Structural)................................................................................................................... 11
Protection proxy............................................................................................................... 11
Remote proxy...................................................................................................................11
Virtual proxy..................................................................................................................... 11
Multithreading............................................................................................................................ 12
Levenscyclus......................................................................................................................... 12
Priorities & Scheduling...........................................................................................................12
ThreadLocalRandom............................................................................................................. 13
Creatie & Executie van threads............................................................................................. 13
.run()................................................................................................................................ 13
Aanmaken........................................................................................................................13
Starten............................................................................................................................. 13
Threadpool Maken........................................................................................................... 13
Thread Synchronisatie...........................................................................................................13
Locks................................................................................................................................13
Producer/consumer relatie (zonder synchronisatie).............................................................. 14
Producer/consumer relatie (met synchronisatie)................................................................... 15
Methodes van klasse Object............................................................................................15
Praktische uitvoering: locks, conditions, await() en signal().............................................15
Set methode.....................................................................................................................16
Get methode.................................................................................................................... 17
Product/consumer relatie: ArrayBlockingQueue....................................................................17
Interface Callable...................................................................................................................18
Stop, suspend & resume threads.......................................................................................... 18

,Design Patterns

Factory Method (Creational)




PizzaStore (abstracte klasse) als Creator.
GhentPizzaStore en BrusselsPizzaStore als Concrete Creator

Beide concrete creators implementeren de abstracte methode createPizza en geven daarbij de
pizza die tot hen behoort. Deze wordt in dit voorbeeld onderling opgeroepen in orderPizza.
Pizza (product) kan hier een abstracte of interface klasse zijn.

Voorbeeld code:
GhentPizzaStore ghentPizzaStore = new GhentPizzaStore();
ghentPizzaStore.orderPizza("pepperoni");

, Abstract Factory (Creational)




De statische methode getFactory zorgt er voor dat we de juiste AbstractFactory terug krijgen.
Eens dat we de juiste factory hebben, kunnen we voort met hun getShape methodes.


Voorbeeld code:
// Aanmaak rounded figuren
AbstractFactory roundedFactory = FactorySupplier.getFactory("rounded");

Shape shape1 = roundedFactory.getShape("RECTANGLE");
shape1.draw();
Shape shape2 = roundedFactory.getShape("SQUARE");
shape2.draw();

// Aanmaak smooth figuren
AbstractFactory smoothFactory = FactorySupplier.getFactory("smooth");
Shape shape3 = smoothFactory.getShape("RECTANGLE");
shape3.draw();
Shape shape4 = smoothFactory.getShape("SQUARE");
shape4.draw();
$9.68
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
HoGentToegepasteInformatica

Get to know the seller

Seller avatar
HoGentToegepasteInformatica Hogeschool Gent
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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