Thursday, 17 October 2024

Design Pattern in Apex

 1) Singleton - example utlity class


2) Facade  - A simple and easy-to-understand example of the Facade pattern is a Computer System. When you press the power button on your computer, several subsystems (like the CPU, Memory, Hard Drive) need to work together to start the computer. Instead of interacting with these subsystems individually, you interact with a single, unified interface—the power button.


3) Strategy pattern  - Strategy pattern is a perfect example of runtime polymorphism, where different behaviors (strategies) can be swapped in and out dynamically, depending on the situation.


Factory Pattern - create interface and implements interface

No comments:

Post a Comment

Heap Size and Apex CPU Time Limit

  Heap Size - 1) Memory size for holding object , variables and records 2) CPU Time limit -  1) time consuming during whole transaction   ...