SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Downloaden Sie, um offline zu lesen
Shorten Your Development Time
with An Extensible Design for Apex!
(NOT a Uni-tasker!)
Robert Nunemaker, Citrix Systems Inc., Senior Systems Architect
Safe harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties
materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results
expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be
deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other
financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any
statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new
functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our
operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any
litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our
relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our
service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to
larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is
included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent
fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor
Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently
available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions
based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these
forward-looking statements.
Robert J Nunemaker
Senior Systems Architect
Ask Yourself
• How many of you have triggers and/or classes that have hundreds of
lines?
• How many have had to spend hours reverse engineering code just to find
where something occurs, its dependencies, and how to change it?
• How many don’t code, but wish they could know what is going on inside
the multiple triggers?
• Why can’t we get contractors/new hires to code consistently?
Objectives
• Provide another flexible tool for your Apex Development
• Provoke thought into standard patterns (or free-style) that don’t take shared resources into
account.
• Provide a pattern that managers, analysts, and developers alike can benefit from.
• Advantages:
o Scales VERY well.
o VERY readable and easy to maintain.
o VERY modular and a single point of DML and Error handling.
o Limits reverse engineering and regression testing.
The Design!
• What IS EDA?
o Event, Dispatch, Action
o Learn the parable of the Plumber!
• Error Handling Benefits
o One place of handling; no need to handle again.
o DML for other objects rolled back to requesting object.
The Design!
Let’s look an example trigger for a custom object called Account_Segmentation__c using Eclipse.
The Design! (Enhancement)
• When an Account Segmentation is Deleted, we need to update all linking Account Segmentation fields to be initialized
to NULL.
• How? EASY!
o Create your Service method first to update Accounts as necessary. Notice how you can concentrate on the task;
not the “hooks”.
o BUT, those updates are to be put into the sObject LIST for update by the Dispatcher (already coded!).
o Don’t forget your errorMAP population.
o Finally add your small code fragment in your Dispatch Action method:

o DONE!
The Design!
• Considerations
o Script statements limits are now effectively removed in Winter ’14.
o Modularization of functionality.
o Other patterns can be used in the Service (Action).
o @Future must still be done in Service.
o Test class considerations (bPreventRecursion).
• Non-Developer Benefits
o No need to read code; just look at Dispatcher Action methods.
o After initial development, enhancements much faster.
o Regression testing easier and sometimes not necessary!
• Snippets in Eclipse!
Final Thoughts
• Hopefully you’ve seen how this pattern can benefit stability, scale, maintainability, and
development velocity.
o Ask yourself – Where can you benefit?
• It can be used by developers, analysts, and management to aid them in clarity and future
development needs.
• Even if you don’t use it as shown, maybe it will lead you to some ideas of how to make yourself
more scalable or efficient.
• Most important, does it help you provide better velocity in your enhancements to your customers?
• Chatter posting will include the code, including enhancement code, and instructions on how to
create your own Snippets for Eclipse!
Shorten Your Development Time with an Extensible Design for Apex
Shorten Your Development Time with an Extensible Design for Apex

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

AMC Networks Experiments Faster on the Server Side
AMC Networks Experiments Faster on the Server SideAMC Networks Experiments Faster on the Server Side
AMC Networks Experiments Faster on the Server Side
 
Using Prototypes to Validate Product Strategy - Product Camp DC Presentation ...
Using Prototypes to Validate Product Strategy - Product Camp DC Presentation ...Using Prototypes to Validate Product Strategy - Product Camp DC Presentation ...
Using Prototypes to Validate Product Strategy - Product Camp DC Presentation ...
 
Episode 12 - Basics of Trigger
Episode 12 - Basics of TriggerEpisode 12 - Basics of Trigger
Episode 12 - Basics of Trigger
 
The What, Why and How of Analytics Testing
The What, Why and How of Analytics TestingThe What, Why and How of Analytics Testing
The What, Why and How of Analytics Testing
 
Building Test Automations the agile way
Building Test Automations the agile way Building Test Automations the agile way
Building Test Automations the agile way
 
Data-Driven Software Design
Data-Driven Software DesignData-Driven Software Design
Data-Driven Software Design
 
Enabling CD in Enterprises with Testing
Enabling CD in Enterprises with TestingEnabling CD in Enterprises with Testing
Enabling CD in Enterprises with Testing
 
Shift Up
Shift Up Shift Up
Shift Up
 
Continuous business goal validation
Continuous business goal validationContinuous business goal validation
Continuous business goal validation
 
Beyond DevOps - How Netflix Bridges the Gap
Beyond DevOps - How Netflix Bridges the GapBeyond DevOps - How Netflix Bridges the Gap
Beyond DevOps - How Netflix Bridges the Gap
 
You Can't be Agile When you are Knee Deep in Mud
You Can't be Agile When you are Knee Deep in Mud You Can't be Agile When you are Knee Deep in Mud
You Can't be Agile When you are Knee Deep in Mud
 
Why software projects fail in 2021?
Why software projects fail in 2021?Why software projects fail in 2021?
Why software projects fail in 2021?
 
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
Optimizely NYC Developer Meetup - Experimentation at Blue ApronOptimizely NYC Developer Meetup - Experimentation at Blue Apron
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
 
Tdd2018 state of the software quality in Germany
Tdd2018 state of the software quality in GermanyTdd2018 state of the software quality in Germany
Tdd2018 state of the software quality in Germany
 
Best Practices for a Repeatable Shift-Left Commitment
Best Practices for a Repeatable Shift-Left CommitmentBest Practices for a Repeatable Shift-Left Commitment
Best Practices for a Repeatable Shift-Left Commitment
 
Prototyping for Business Outcomes at ModevUX
Prototyping for Business Outcomes at ModevUXPrototyping for Business Outcomes at ModevUX
Prototyping for Business Outcomes at ModevUX
 
iOS Testing With Appium at Gilt
iOS Testing With Appium at GiltiOS Testing With Appium at Gilt
iOS Testing With Appium at Gilt
 
HPE | Network Virtualization | POC
HPE | Network Virtualization | POCHPE | Network Virtualization | POC
HPE | Network Virtualization | POC
 
Developer Night Opticon 2017
Developer Night Opticon 2017Developer Night Opticon 2017
Developer Night Opticon 2017
 
Rasa Developer Summit - Tom Bocklisch, Rasa - Product Updates from Rasa
Rasa Developer Summit - Tom Bocklisch, Rasa - Product Updates from RasaRasa Developer Summit - Tom Bocklisch, Rasa - Product Updates from Rasa
Rasa Developer Summit - Tom Bocklisch, Rasa - Product Updates from Rasa
 

Ähnlich wie Shorten Your Development Time with an Extensible Design for Apex

Tailoring the DITA Suit to Fit
Tailoring the DITA Suit to FitTailoring the DITA Suit to Fit
Tailoring the DITA Suit to Fit
Salesforce Engineering
 
Five Admin Tips Every Developer Should Know
Five Admin Tips Every Developer Should KnowFive Admin Tips Every Developer Should Know
Five Admin Tips Every Developer Should Know
Salesforce Developers
 

Ähnlich wie Shorten Your Development Time with an Extensible Design for Apex (20)

Development Best Practices
Development Best PracticesDevelopment Best Practices
Development Best Practices
 
Transition to the Lightning Experience: Pro Tips, Tools and a Transition Stra...
Transition to the Lightning Experience: Pro Tips, Tools and a Transition Stra...Transition to the Lightning Experience: Pro Tips, Tools and a Transition Stra...
Transition to the Lightning Experience: Pro Tips, Tools and a Transition Stra...
 
Coding for Declarative Customizations: How We Do It in Salesforce.com IT
Coding for Declarative Customizations: How We Do It in Salesforce.com ITCoding for Declarative Customizations: How We Do It in Salesforce.com IT
Coding for Declarative Customizations: How We Do It in Salesforce.com IT
 
Tailoring the DITA Suit to Fit
Tailoring the DITA Suit to FitTailoring the DITA Suit to Fit
Tailoring the DITA Suit to Fit
 
Five Admin Tips Every Developer Should Know
Five Admin Tips Every Developer Should KnowFive Admin Tips Every Developer Should Know
Five Admin Tips Every Developer Should Know
 
Build Apps Fast with Lightning Components from Apttus
Build Apps Fast with Lightning Components from ApttusBuild Apps Fast with Lightning Components from Apttus
Build Apps Fast with Lightning Components from Apttus
 
Lightning Developer Experience, Eclipse IDE Evolved
Lightning Developer Experience, Eclipse IDE EvolvedLightning Developer Experience, Eclipse IDE Evolved
Lightning Developer Experience, Eclipse IDE Evolved
 
Bridging the Gap between Clicks & Code
Bridging the Gap between Clicks & CodeBridging the Gap between Clicks & Code
Bridging the Gap between Clicks & Code
 
Df14 Maintaining your orgs setup for optimal efficiency for dist
Df14 Maintaining your orgs setup for optimal efficiency for distDf14 Maintaining your orgs setup for optimal efficiency for dist
Df14 Maintaining your orgs setup for optimal efficiency for dist
 
Planning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning ExperiencePlanning Your Migration to the Lightning Experience
Planning Your Migration to the Lightning Experience
 
Puppet Camp San Francisco 2015: Puppet Adoption in a Mature Environment
Puppet Camp San Francisco 2015: Puppet Adoption in a Mature EnvironmentPuppet Camp San Francisco 2015: Puppet Adoption in a Mature Environment
Puppet Camp San Francisco 2015: Puppet Adoption in a Mature Environment
 
The Apex Interactive Debugger
The Apex Interactive DebuggerThe Apex Interactive Debugger
The Apex Interactive Debugger
 
Developing Salesforce Console Apps with Visualforce & the Integration Toolkit
Developing Salesforce Console Apps with Visualforce & the Integration ToolkitDeveloping Salesforce Console Apps with Visualforce & the Integration Toolkit
Developing Salesforce Console Apps with Visualforce & the Integration Toolkit
 
Best Practices for Team Development in a Single Org
Best Practices for Team Development in a Single OrgBest Practices for Team Development in a Single Org
Best Practices for Team Development in a Single Org
 
Move to Lightning in 60 Days - Admin Webinar
Move to Lightning in 60 Days - Admin WebinarMove to Lightning in 60 Days - Admin Webinar
Move to Lightning in 60 Days - Admin Webinar
 
Einstein Analytics for Developers
Einstein Analytics for DevelopersEinstein Analytics for Developers
Einstein Analytics for Developers
 
Manage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance FrameworkManage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance Framework
 
Salesforce – Proven Platform Development with DevOps & Agile
Salesforce – Proven Platform Development with DevOps & AgileSalesforce – Proven Platform Development with DevOps & Agile
Salesforce – Proven Platform Development with DevOps & Agile
 
A Pocket Guide to Process Builder, Flows, and Triggers
A Pocket Guide to Process Builder, Flows, and TriggersA Pocket Guide to Process Builder, Flows, and Triggers
A Pocket Guide to Process Builder, Flows, and Triggers
 
Success Services - Change management best practices
Success Services - Change management best practicesSuccess Services - Change management best practices
Success Services - Change management best practices
 

Mehr von Salesforce Developers

Mehr von Salesforce Developers (20)

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base Components
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer Highlights
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX India
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local Development
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web Components
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer Highlights
 
Live coding with LWC
Live coding with LWCLive coding with LWC
Live coding with LWC
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce data
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCP
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in Salesforce
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data Capture
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DX
 
Get Into Lightning Flow Development
Get Into Lightning Flow DevelopmentGet Into Lightning Flow Development
Get Into Lightning Flow Development
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS Connect
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Shorten Your Development Time with an Extensible Design for Apex

  • 1. Shorten Your Development Time with An Extensible Design for Apex! (NOT a Uni-tasker!) Robert Nunemaker, Citrix Systems Inc., Senior Systems Architect
  • 2. Safe harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  • 3. Robert J Nunemaker Senior Systems Architect
  • 4. Ask Yourself • How many of you have triggers and/or classes that have hundreds of lines? • How many have had to spend hours reverse engineering code just to find where something occurs, its dependencies, and how to change it? • How many don’t code, but wish they could know what is going on inside the multiple triggers? • Why can’t we get contractors/new hires to code consistently?
  • 5. Objectives • Provide another flexible tool for your Apex Development • Provoke thought into standard patterns (or free-style) that don’t take shared resources into account. • Provide a pattern that managers, analysts, and developers alike can benefit from. • Advantages: o Scales VERY well. o VERY readable and easy to maintain. o VERY modular and a single point of DML and Error handling. o Limits reverse engineering and regression testing.
  • 6. The Design! • What IS EDA? o Event, Dispatch, Action o Learn the parable of the Plumber! • Error Handling Benefits o One place of handling; no need to handle again. o DML for other objects rolled back to requesting object.
  • 7. The Design! Let’s look an example trigger for a custom object called Account_Segmentation__c using Eclipse.
  • 8. The Design! (Enhancement) • When an Account Segmentation is Deleted, we need to update all linking Account Segmentation fields to be initialized to NULL. • How? EASY! o Create your Service method first to update Accounts as necessary. Notice how you can concentrate on the task; not the “hooks”. o BUT, those updates are to be put into the sObject LIST for update by the Dispatcher (already coded!). o Don’t forget your errorMAP population. o Finally add your small code fragment in your Dispatch Action method: o DONE!
  • 9. The Design! • Considerations o Script statements limits are now effectively removed in Winter ’14. o Modularization of functionality. o Other patterns can be used in the Service (Action). o @Future must still be done in Service. o Test class considerations (bPreventRecursion). • Non-Developer Benefits o No need to read code; just look at Dispatcher Action methods. o After initial development, enhancements much faster. o Regression testing easier and sometimes not necessary! • Snippets in Eclipse!
  • 10. Final Thoughts • Hopefully you’ve seen how this pattern can benefit stability, scale, maintainability, and development velocity. o Ask yourself – Where can you benefit? • It can be used by developers, analysts, and management to aid them in clarity and future development needs. • Even if you don’t use it as shown, maybe it will lead you to some ideas of how to make yourself more scalable or efficient. • Most important, does it help you provide better velocity in your enhancements to your customers? • Chatter posting will include the code, including enhancement code, and instructions on how to create your own Snippets for Eclipse!