100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Samenvatting ASD2 $8.92   Add to cart

Summary

Samenvatting ASD2

 7 views  0 purchase
  • Course
  • Institution

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.

Preview 3 out of 19  pages

  • July 26, 2024
  • 19
  • 2023/2024
  • Summary
avatar-seller
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();

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 HoGentToegepasteInformatica. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

81849 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
$8.92
  • (0)
  Add to cart