Multiple choice technology architecture

Suppose I have to code a program to draw 1000 circles with 6 different colors – Which Structural Pattern approach would help?

  1. Façade.

  2. FlyWeight.

  3. Decorator.

  4. Adpater

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Flyweight Pattern minimizes memory by sharing intrinsic state (common data like color) across multiple objects, while storing extrinsic state (position, size) separately. For 1000 circles with only 6 colors, Flyweight would create just 6 shared circle objects (one per color) rather than 1000 separate objects. Facade simplifies interfaces. Decorator adds responsibilities dynamically. Adapter bridges incompatible interfaces.