Currently most implementations are based on multiple APEX patterns and factories that makes really complicated the work between several developers or teams.
The session will be explain how to migrate from a more monolithic code and way of solving requirements into a more extensible way, this by showing how to change the thinking and ways of coding for experience developers but also show the junior devs to think in a more scalable way since the beginning of projects.
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
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?
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?
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?
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
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!