Apex Design Patterns
Amit Chaudhary

Amit Chaudhary

Amit Chaudhary is Salesforce Application & System Architect and working on Salesforce Platform since 2010. He is Salesforce MVP since 2017 and have 17 Salesforce Certificates. He is a active blogger and founder of Apex Hours.

Apex Design Patterns

Playing with data structures and algorithms for complex problems is always fun. Let’s see how we can implement those algorithms in Salesforce using Apex Design patterns. Object Oriented Programming is key for a design pattern. We will learn the basics of Object Oriented Programming and understand when we should use a Design pattern, Technical deep dive into different patterns, and some real examples of Apex Design patterns.

What are Design Patterns?

Design patterns are class structures that solve many of the commonly occurring issues in software. If algorithms are like baking instructions, then design patterns are like blueprints. They allow us to share a similar vocabulary of abstraction above that of implementation.

Type of Apex Design Patterns

Here are patterns we will be discussing in the blog post:

Singleton Design pattern in Apex

The Singleton pattern is a creational pattern – it helps you to instantiate objects in a particular way. It allows for the existence of only one instance of an object, but everyone has global access to that object. Singletons can help improve performance and reduce memory footprint.

Builder Pattern

The builder pattern is a creational pattern – it helps you to instantiate objects in a particular way. This pattern allows you to construct complicated objects step by step. Builders help to populate immutable private variables at construction without a multiple position based constructor arguments

Strategy Pattern (aka the policy pattern)

The strategy pattern is a behavioral pattern that helps you control dynamic application flow. This pattern allows us to define a family of algorithms through multiple classes which implement an interface. The choice of which implementation to use is determined at runtime.

Command Pattern

A command pattern is a data-driven design pattern and falls under the behavioral pattern category. A request is wrapped under an object as a command and passed to the invoker object. Invoker object looks for the appropriate object which can handle this command and passes the command to the corresponding object which executes the command

Facade Pattern

Simplifying the execution of classes with complex interfaces (e.g. web service callouts)

Factory Pattern

Factory pattern is one of the most used design patterns in Java. This type of design pattern comes under creational pattern as this pattern provides one of the best ways to create an object.

Apex Design Patterns Training

There are different design patterns available but in this Apex Design patterns training will cover 4 design patterns with object-oriented Programming language brush up on vocabulary

  1. Object Oriented Programming
  2. Singleton: There can only be one – [ Sept 15, 2022, 9:00 AM EST ]
  3. Strategy: Make a gametime call – [ TBD after Dreamforce ]
  4. Builder: Construct complex objects [ TBD after Dreamforce ]
  5. Command: Execute an action by name [ TBD after Dreamforce ]

Don’t miss this FREE training from Google Senior Engineer Mitch Spano. All sessions will be live stream on Apex Hours YouTube Channel at the scheduled time. Please follow our ApexHours website and subscribe to our YouTube Channel and click on the bell icon to get more notifications.

If you have any doubts or queries on any session then please add a comment in the respective session, our team will try to help you as soon as possible.

For more join, our telegram channels ūüďĆ https://t.me/apexHours.

Apex Design Pattern Book

Don’t forget to buy the Apex Design Patterns book by Jitendra Zaa.

Summary

I hope this Apex Design patterns training will help you become a good developer. To learn more check the Apex Enterprise Patterns session from apex hours.

Share this article

Leave a reply

Keep in Touch

Subscribe for Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,230 other subscribers

Search

Our Supporter

RECENT POSTS

Apex Hours

Apex Hours is one stop platform to learn Salesforce skills and technology

Join our Newsletter and get tips and tricks how to explore the salesforce for free!