Comments (9)
I have challenges with 3 and 4 around the suggestion of implementing cross-object behaviour at the Domain layer, especially when they are invoked by triggers.
At worst, such a design could inadvertently cause a chain reaction of triggers which results to a variety of problems that are particularly difficult to troubleshoot and untangle without regression issues (e.g. SOQL limits, CPU time limit, trigger recursions, etc). The domain layer approach won't scale well in an org with a complex data model and business rules that grow after each iteration.
The resolution typically involves refactoring code back to a Service layer which in SFDC also implies sacrificing SFDC's standard forms (new/edit pages) with custom controller or controller extensions.
from fflib-apex-common.
Fowlers definitions...
Service Layer, “Defines an application's boundary with a layer of services that establishes a set of available operations and coordinates the application's response in each operation.” Martin Fowler / Randy Stafford, EAA Patterns
Domain Model, “An object model of the domain that incorporates both behavior and data.”, “At its worst business logic can be very complex. Rules and logic describe many different cases and slants of behavior, and it's this complexity that objects were designed to work with...” Martin Fowler, EAA Patterns
from fflib-apex-common.
I'd like a few views on the Type of Application Concerns i've listed above as well as other concerns we could list to help people understand where placement goes in what scenarios. I suspect sometimes just having some tightly written code in the service layer could be a preference at times to breaking things out into domain layer calcs or updates?
from fflib-apex-common.
Great feedback @jmrjulian thank you, will give this some thought!
from fflib-apex-common.
@afawcett I am building a complex subscription management system in which bulk of the business logic is invoked through triggers. There are certain scenarios where I don't want subsequent triggers to fire (stop recursion as well as chaining of triggers). Can you please provide me some guidance on that? I don't want all trigger methods to stop but want to control which ones should be skipped. Can we build something in fflib_SObjectDomain class for this?
from fflib-apex-common.
@afawcett also it would be great if we can build some control through custom settings so admins can turn on/off triggers when they want to perform certain operations like data load without invoking triggers.
from fflib-apex-common.
I think this is what you're looking for :)
https://andyinthecloud.com/2016/04/13/disabling-trigger-events-in-apex-enterprise-patterns/
Chris Mail
On 10 Jun 2016, at 11:23, mustafaturabali [email protected] wrote:
@afawcett also it would be great if we can build some control through custom settings so admins can turn on/off triggers when they want to perform certain operations like data load without invoking triggers.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
from fflib-apex-common.
@mustafaturabali does at @Autobat's answer help?
(thanks btw @Autobat )
from fflib-apex-common.
I'll close this issue for now, its bene open since Feb and really was just a feedback call out. Folks can still add to this issue even though its closed.
from fflib-apex-common.
Related Issues (20)
- Unit test failure in multi-currency org HOT 4
- Deploy button doesn't deploy because there are test failures HOT 1
- Expected a QueryException due to read only user not having access to Opportunity HOT 7
- Switch to Inherited Sharing on SObjectDescribe and SObjectSelector HOT 2
- With latest fflib, do TriggerHandlers become service class consumers? If so what happens to UoW? HOT 6
- Selected tests in fflib_SObjectSelectorTest fail in an org with encryption enabled on Account.Name HOT 2
- Selector Mocks to Include SOQL Query Retrieve Check HOT 1
- fflib_SObjectUnitOfWork doCommitWork executes all dml for all registered types even if there are no changes
- Update README as session recordings are not available HOT 2
- fflib_SObjectDescribe.cls fails to resolve cross-object field paths for Person Accounts
- Aggregate SOQL support. HOT 2
- Disable Savepoint in tests HOT 4
- Inconsistent Code Coverage and Test Failures in fflib-apex-common HOT 1
- fflib_SObjectSelector and fflib_SObjectUnitOfWork have insufficient test code coverage. HOT 2
- Add queryWithBinds to Selector layer HOT 2
- Unit test failing fflib_SecurityUtilsTest & sysadmin_objectAndField_access HOT 8
- Coverage of UnitOfWork class HOT 1
- Versioning HOT 1
- fflib_SObjectSelectorTest failure with Lookup relationship and Person Type Accounts HOT 5
- fflib_SObjectSelectorTest Error: 'Assertion Failed: Expected: 12345.67, Actual: 9117.25' HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fflib-apex-common.