Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Episode 22 - Design Pattern 2

546 views

Published on

Part 2 of Apex Design Patterns in Salesforce

Published in: Education
  • Be the first to comment

  • Be the first to like this

Episode 22 - Design Pattern 2

  1. 1. Path to Code Begin Your Salesforce Coding Adventure
  2. 2. Episode 22 Design Pattern - Part 2
  3. 3. Jitendra Zaa Salesforce MVP Sr Technical Architect 23x Certified @Jitendra Zaa Speaker
  4. 4. Agenda • Creational Design Pattern Demo • Singleton and • Factory Methods • Q&A
  5. 5. Some House Rules • Please mute your mic • Keep adding questions in Zoom Q&A Window • No question is too small • Questions will be answered in last 15 mins
  6. 6. Gang of Four Patterns Creational Patterns Structural Behavioral 1. Abstract Factory 6. Adapter 13. Chain of responsibility 2. Builder 7. Bridge 14. Command 3. Factory Method 8. Composite 15. Intercepter 4. Prototype 9. Decorator 16. Iterator 5. Singleton 10. Facade 17. Mediator 11. Fly Weight 18. Memento 12. Proxy 19. Observer 20. State 21. Strategy 22. Template Method 23. Visitor
  7. 7. Problem On Lead Insert - Auto Populate Rating, on basis of company. Mapping between Company and Rating Stored in different Table.
  8. 8. Code to Resolve Problem Gist - https://gist.github.com/JitendraZaa/530ee1009d48a5cf94f641a454f54 421
  9. 9. New Requirement If Website field present then set Lead Source field = Web. No Developer in team , so Admin decided it can be easily done using Workflow rule or Process Builder
  10. 10. Impact of Process Builder Total Number of SOQL doubled. Check - Sequence of Operation
  11. 11. Singleton Solution Gist - https://gist.github.com/JitendraZaa/4b2998dbcc707ccd041f00699 87e99c4
  12. 12. Factory Pattern
  13. 13. Definition Factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.
  14. 14. Sample Code Gist - https://gist.github.com/JitendraZaa/036bd15906f5a288e7b0a9160e55 bebf
  15. 15. Summary of Classes
  16. 16. Reference • Apex Design Patterns • SOLID Principle • Trigger Factory Pattern
  17. 17. Q&A
  18. 18. Next Episode 23 Design Pattern - 3
  19. 19. Thanks

×