Hello All,
Is there any design pattern/s, that AEM is built on top of it? i.e: List of design patterns that most of the AEM features follows. example: Services in AEM are singleton
Can someone explain the design patterns that they have used to do do some operations in your AEM applications. Thanks in advance.
Solved! Go to Solution.
Hello @Mahesh_Gunaje
1. Model-View-Controller (MVC) Pattern:
AEM uses the MVC pattern to separate the data models (Java classes or Sling models), the views (JSP or HTL templates), and the controllers (Java classes or Sling servlets) for rendering web pages.
2. Singleton Pattern:
Example: AEM uses the Singleton pattern to ensure that there is only one instance of critical objects like the OSGi service component or the AEM service.
3. Factory Pattern:
AEM employs the Factory pattern to create objects based on a common interface or abstract class. For instance, the OSGi service component factory provides multiple instances of the same service implementation.
4. Adapter Pattern:
AEM uses the Adapter pattern to convert one interface into another. For example, the Sling Adapter Factory enables adapting a resource to various adaptable types. Example: Resource -> Page
5. Composite Pattern:
AEM leverages the Composite pattern to treat a group of objects as a single object. For instance, AEM's component-based architecture allows creating composite components with child components.
6. Observer Pattern:
AEM utilizes the Observer pattern to establish a one-to-many dependency between objects. For instance, AEM's Event Listeners and Event Handlers follow the Observer pattern to react to specific events.
Hi,
You can refer https://computepatterns.com/osgi-design-patterns/ for OSGI design patterns with sample implementations.
Hello @Mahesh_Gunaje
1. Model-View-Controller (MVC) Pattern:
AEM uses the MVC pattern to separate the data models (Java classes or Sling models), the views (JSP or HTL templates), and the controllers (Java classes or Sling servlets) for rendering web pages.
2. Singleton Pattern:
Example: AEM uses the Singleton pattern to ensure that there is only one instance of critical objects like the OSGi service component or the AEM service.
3. Factory Pattern:
AEM employs the Factory pattern to create objects based on a common interface or abstract class. For instance, the OSGi service component factory provides multiple instances of the same service implementation.
4. Adapter Pattern:
AEM uses the Adapter pattern to convert one interface into another. For example, the Sling Adapter Factory enables adapting a resource to various adaptable types. Example: Resource -> Page
5. Composite Pattern:
AEM leverages the Composite pattern to treat a group of objects as a single object. For instance, AEM's component-based architecture allows creating composite components with child components.
6. Observer Pattern:
AEM utilizes the Observer pattern to establish a one-to-many dependency between objects. For instance, AEM's Event Listeners and Event Handlers follow the Observer pattern to react to specific events.
Hi @Mahesh_Gunaje ,
Please refer to this video - https://www.youtube.com/watch?v=flHjyzSJhrI
which talks about following design patterns which can be used in AEM
1. OSGi Declarative Services
2. Service Locator Design Pattern
3. Command Design Pattern
4. Events Sourcing Design Pattern
5. Singleton Design Pattern
6. Adapter Design Pattern
7. Factory Design Pattern
8. Proxy Design Pattern
9. Decorator Design Pattern
10. Observer Design Pattern
11. Chain of Responsibility Design Pattern
Thanks,