Advertisement

How to migrate to Apex Enterprise Patterns?, David Fernandez

CzechDreamin
Jun. 14, 2022
Advertisement

More Related Content

Advertisement

More from CzechDreamin(20)

Advertisement

How to migrate to Apex Enterprise Patterns?, David Fernandez

  1. How to migrate to Apex Enterprise Patterns? by David Fernandez
  2. #CD22 - Long time developer. - Some years of experience in Salesforce ecosystem. - Artificial Intelligence enthusiast. @DfdezR dfernandezr/ Salesforce Innovation Squad Lead at Bluez.io
  3. #CD22 ● What are Apex Enterprise Patterns? ● Why should I Migrate to Apex Enterprise Patterns? ● Where to start? ○ Selector Approach ○ Service Approach ○ Domain Approach ● Tips and Study Materials ● Q & A Agenda
  4. #CD22 ● Who, What, When? ● Separation Of Concerns ● DRY ● SOC = Code Reuse? What are Apex Enterprise Patterns?
  5. #CD22 SELECTOR PATTERN
  6. #CD22 DOMAIN PATTERN
  7. #CD22 SERVICE PATTERN
  8. #CD22 UNIT OF WORK PATTERN
  9. #CD22 ● Facilitates collaborative teamwork between developers ● Allows evolution of complexity ● Sets a good ground for scalability ● Less Tests!!!! (When developing new stuff) ● Prepares the implementations to implement new technologies (Salesforce DX) Why should I Migrate to Apex Enterprise Patterns?
  10. #CD22 ● Do I need AEP? Where to start?
  11. #CD22 ● Realistically evaluate the developers maturity and establish responsibilities. ● Be aware of the amount of time to dedicate. ● Focus on those pain points to start (Fix, don’t patch). ● Think and implement new functionalities into the change of mind. What factors I need to successfully migrate?
  12. #CD22 Selector Approach Domain Approach Service Approach Ok I want to migrate, I can do it, but… Where do I start?
  13. #CD22 1. Select object 2. Find ALL query usages 3. Inject selector in usages 4. Start Service implementation 5. Start Domain implementation 6. Controllers 7. Triggers/Batches Selector Approach
  14. #CD22 1. Select object 2. Create SINGLE trigger 3. Move all trigger functionalities and DML related operations 4. Start Selectors implementation 5. Start Services implementations 6. Controllers 7. Batches Domain Approach
  15. #CD22 1. Select object 2. Find ALL business usages of object 3. Isolate specific functionalities in specific services 4. Start Selectors implementation 5. Start Domain implementations 6. Triggers/Batches 7. Controllers Service Approach
  16. #CD22 Q & A
  17. #CD22 - https://trailhead.salesforce.com/en/content/learn/modules/apex_pattern s_sl - https://trailhead.salesforce.com/en/content/learn/modules/apex_pattern s_dsl - https://andyinthecloud.com/ - https://www.apexhours.com/apex-enterprise-patterns/ - https://quirkyapex.com/ Tips and Study Materials
  18. Thank you! #CD22

Editor's Notes

  1. 1 - Created by financial force Framework which supports implementation of various Martin Fowler design patterns, in 2014 Andy Fawcett adapted it to SF FFLIB Apex Mocks An Apex mocking framework for true unit testing in Salesforce, with Stub API support Based on the Java mocking framework Mockito FFLIB Apex Commons FFLIB frameworks are now maintained by the Apex Enterprise Patterns GitHub group 2 Complex code gets out of hand when you don’t partition it properly. When code is heavily intermixed, it becomes error prone, difficult to maintain, and hard to learn. Have you ever tried to debug someone's spaghetti code? And the problems get worse as you bring new developers into the party! Creating modules or libraries to share common calculations and processes among different parts of your application is often the first step in code reuse, which is, of course, a good thing! Each layer should have a single responsability 3. Dont Repeat Yourself 4.- Yes... and no. SOC requires some upfront thinking about the internal plumbing of your application, including class naming conventions and coding guidelines. You want this planning to endure and be somewhat self-describing to others. Good code should tell a story. The usual approach to code reuse is moving fragments of code around as soon as two or more areas need it. The code is often just placed in MyUtil classes or some other generic dumping area. Which is fine, and certainly recommended to copy and paste!
  2. Extend points
  3. Extend points
Advertisement