-
Notifications
You must be signed in to change notification settings - Fork 556
Description
Firstly - thanks for sharing the patterns!
This post was prompted by a brief exchange with Andrew after this tweet :
Great call with @LaceySnr this morning, talking about Apex Enterprise Patterns “Light” and consulting project usage! @SalesforceDevs
— Andrew Fawcett (@andyinthecloud) March 6, 2015
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
At the time I was trying to decide whether to use the patterns in my upcoming project but was concerned about the complexity. Hence, my interest in a ‘Light’ version…
We’ve been on Salesforce for about 18 months and our implementation, although not particularly large, covers quite a lot of the platform with two-way integrations to our website on the frontend and our legacy ERP on the backend, scheduled & batch Apex plus the usual VF controllers and triggers etc. At this stage I'm starting to feel the maintenance pain and therefore very receptive to the ‘separation of concerns’ approach.
I’m the business owner and spend only a small part of my time as a ‘developer’, going months (if all is running well) without touching the code… but we’re about to embark on another phase of implementation involving FinancialForce Accounts & HCM and then re-implementing what’s left of the ERP in Salesforce.
In short I want maximum separation of concerns to help with maintainability but with minimum complexity!
I've seen this post from Matt Lacey but I’m not confident enough to go pulling the framework apart and I have a feeling that I’m going to find some of the more advanced parts, eg mocks, useful once I get into it, so my approach to 'Light' so far is to just pick what seem like the more straightforward and approachable parts and start there. Something like this :
- Application class that just implements Unit of Work
- Service classes - I’d already started collecting related methods into classes so this involves the adoption of a more formal and disciplined approach to this, and Unit of Work is helpful here
- Selector classes - pretty straightforward to implement and address an issue that I’ve already experienced trouble with (consistency of fields returned via SOQL)
- Domain class - this one seems less obvious but plan to try it out next time I need to code a trigger
- Avoid most of the interfaces/factories/mocks ie the 'advanced' stuff, at least for the time being
I plan to try this with new code or when any of the existing code has to be reworked.
I’d be interested to hear how others have approached getting started and working with the patterns.