SlideShare a Scribd company logo
1 of 16
Download to read offline
Five Enterprise Best Practices That
EVERY Salesforce Org Can Use
Vivek M. Chawla
Salesforce MVP | Senior Software Engineer, Intuit | @VivekMChawla
​  Best Practices We’ll Cover
•  Adopt a standard Coding Style
•  Follow trigger best practices
•  Follow unit test best practices
•  Adopt a version of “Separation of Concerns”
•  Adopt specific naming conventions
​  How Each Will Be Presented
•  Key benefits
•  Adoption challenges
•  How to execute
•  Demo
Overview
•  Clean, consistent code
•  Easier to understand / maintain
•  Demonstrates who is willing to
change
•  Difficult to know where to start
•  Difficult to agree on standards
•  Can be like discussing religion!
•  Difficult to enforce
•  Involve the whole team
•  Don’t start from scratch
•  Borrow from the best
•  Write it down
•  Code review
Key Benefits Adoption Challenges How to Execute
Best Practice #1
​ Adopt a Coding Style
•  Scalable code
•  Maintainable code
•  Extensible code
•  Ensuring every developer knows
and understands best practices
•  Choosing a “standard” pattern to
follow can be challenging
•  Refactoring code can be painful
(even unwanted)
•  Understand the best practices
•  Choose a pattern
•  Create reference code (ie.
templates / boilerplate)
•  Leverage code library / snippet
tools
•  Code review
Key Benefits Adoption Challenges How to Execute
Best Practice #2
​ Follow Trigger Best Practices
•  Significant improvement to code
quality
•  Better prevention of regressions
•  Faster deployments
•  Writing good unit tests is hard
•  Payoff is invisible
•  Nobody likes writing test classes
•  Test classes are often written at
the last minute
•  Really difficult to enforce
•  Learn about the best practices
•  Attitude adjustment!
•  Consider test-driven
development
•  Leverage tools like the Force.com
Security Scanner
•  Code Review
Key Benefits Adoption Challenges How to Execute
Best Practice #3
​ Follow Unit Test Best Practices
•  Reusable, extensible code
•  Easier maintenance
•  Greater agility
•  Hard to implement
•  Confusing (until it’s not!)
•  Developer turnover can hinder
adoption
•  Grab the low-hanging fruit
•  Target an “express” version of
SOC
•  Document it, and get developer
acknowledgement
•  Naming conventions are critical
•  You guessed it...Code Review!
Key Benefits Adoption Challenges How to Execute
Best Practice #4
​ Adopt a Version of “Separation of Concerns”
Separation of Concerns (High Level)
Entrypoint Layer
Invocation Layer
Service Layer
Utility Layer
Activities that invoke Apex
•  API / UI Based Create/Update/Delete
•  Visualforce Page / Component Load
•  SFDC Asynchronous Queue, Apex
Scheduler
•  Visualforce Controllers and Extensions
•  Triggers and Trigger Handlers
•  Web and Email Services
•  Asynchronous and Scheduled Apex
•  LeadServices.cls, AccountServices.cls, etc.
•  RegistrationServices.cls, CpqServices.cls, etc.
•  Utility Classes
•  Model / Wrapper Classes
•  Selector Classes
Domain and Function-
specific
Business Logic
“First Line” of Apex Code
Supports the Service Layer
Separation of Concerns (Low Level)
LeadServices.cls AccountServices.clsContactServices.cls
LeadConversionUtil.cls ConvertedLead.clsContactSelector.cls AccountSelector.cls
LeadConv.page Apex Scheduler
SFDC
Asynchronous
Queue
API Based
Create/Edit/Delete
Operation
UI Based
Create/Edit/Delete
Operation
LeadConvController.cls
LeadTrigger.trigger
LeadTriggerHandler.cls
LeadIntAsync.cls LeadCleanJob.clsLeadIntBatch.cls
Entrypoint Layer
Service Layer
Invocation Layer
Utility Layer
•  Simplifies implementation of
Separation of Concerns
•  Code is easier to understand and
maintain
•  Putting thought into names can
encourage better design
•  Choosing a standard is hard
•  Refactoring metadata names in
production is painful
•  Difficult to enforce
•  Choose standards that make
sense to your organization
•  Document your standards
•  Code review…before deploying to
production!
Key Benefits Adoption Challenges How to Execute
Best Practice #5
​ Adopt Specific Naming Conventions
Apex Class and Trigger Names
Functional Type Related Component Related Function Name Suffix Examples
Trigger Account.object Trigger AccountTrigger
Trigger Handler Account.object TriggerHandler AccountTriggerHandler
VF Controller NewAccount.page Controller NewAccountController
Service Class Account.object Services AccountServices
Utility Class Account.object
Identifies duplicate
Accounts
Util AccountDupeCatcherUtil
Web Service (REST) Account.object
Exposes specialized
Account data tools
Rest AccountToolsRest
Asynchronous (Future) Account.object
Performs asynchronous
integration tasks
Async AccountIntegrationsAsync
Asynchronous (Batch) Account.object
Performs high-volume
data migration tasks
Batch AccountMigrationBatch
Scheduled Apex Account.object
Performs data cleanup on
a regular basis
Job AccountCleanupJob
​ Make sure that you...
•  Stay consistent
•  Keep a list of commonly used abbreviations
•  Catch bad names before they go to production
Key Considerations When Naming Things
•  Starts at the top, but has to be a team effort to be
effective in the long term
•  Clear, concise, easy to access documentation is
key
•  When the going gets rough, keep on going
•  Persistence is better than perfection!
Putting it All Together
​ The Importance of Governance
​ Adopt a Coding Style
•  Google’s Java Style Guide
​ Trigger Best Practices
•  Force.com Apex Developer’s Guide - Triggers
•  Trigger Frameworks and Apex Trigger Best
Practices
•  The Simple Trigger Pattern (STP)
•  GitHub Gists
•  GistBox
​ Unit Test Best Practices
•  An Introduction to Apex Code Test Methods
•  How to Write Good Unit Tests
•  Apex Annotations
•  Force.com Security Source Scanner
​ Separation of Concerns
•  Separation of Concerns – Wikipedia
•  Apex Enterprise Patterns – Separation of Concerns
•  DF’12 Recording – Applying Enterprise Design
Patterns
Resources
Q&A
@VivekMChawla
Thank you

More Related Content

What's hot

Apex Trigger Debugging: Solving the Hard Problems
Apex Trigger Debugging: Solving the Hard ProblemsApex Trigger Debugging: Solving the Hard Problems
Apex Trigger Debugging: Solving the Hard ProblemsSalesforce Developers
 
Take a load off! Load testing your Oracle APEX or JDeveloper web applications
Take a load off! Load testing your Oracle APEX or JDeveloper web applicationsTake a load off! Load testing your Oracle APEX or JDeveloper web applications
Take a load off! Load testing your Oracle APEX or JDeveloper web applicationsSage Computing Services
 
O365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin Timmermann
O365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin TimmermannO365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin Timmermann
O365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin TimmermannNCCOMMS
 
Oracle Application Express
Oracle Application ExpressOracle Application Express
Oracle Application ExpressHBoone
 
Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex codeEdwinOstos
 
Best practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata APIBest practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata APISanchit Dua
 
Develop business apps cross-platform development using visual studio with x...
Develop business apps   cross-platform development using visual studio with x...Develop business apps   cross-platform development using visual studio with x...
Develop business apps cross-platform development using visual studio with x...Alexander Meijers
 
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXLOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXEnkitec
 
Access share point-2013-data-with-provider-hosted-apps
Access share point-2013-data-with-provider-hosted-appsAccess share point-2013-data-with-provider-hosted-apps
Access share point-2013-data-with-provider-hosted-appsAlexander Meijers
 
Oracle Forms to Apex - OGh - 29 September 2009 - Part 1
Oracle Forms to Apex - OGh - 29 September 2009 - Part 1Oracle Forms to Apex - OGh - 29 September 2009 - Part 1
Oracle Forms to Apex - OGh - 29 September 2009 - Part 1Douwe Pieter van den Bos
 
Share point 2013 and sql server 2012 what to choose
Share point 2013 and sql server 2012   what to chooseShare point 2013 and sql server 2012   what to choose
Share point 2013 and sql server 2012 what to chooseAlexander Meijers
 
Oracle APEX or ADF? From Requirements to Tool Choice
Oracle APEX or ADF? From Requirements to Tool ChoiceOracle APEX or ADF? From Requirements to Tool Choice
Oracle APEX or ADF? From Requirements to Tool ChoiceSten Vesterli
 
Oracle Apex Technical Introduction
Oracle Apex   Technical IntroductionOracle Apex   Technical Introduction
Oracle Apex Technical Introductioncrokitta
 
Acing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointAcing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointJeremy Thake
 
Application express
Application expressApplication express
Application expressAntony Alex
 
Oracle SQL Developer - POUG 2018
Oracle SQL Developer - POUG 2018Oracle SQL Developer - POUG 2018
Oracle SQL Developer - POUG 2018Sabine Heimsath
 
Oracle apex training | Oracle Application Application Express Training | Ora...
Oracle apex training | Oracle Application Application Express Training |  Ora...Oracle apex training | Oracle Application Application Express Training |  Ora...
Oracle apex training | Oracle Application Application Express Training | Ora...Nancy Thomas
 
Oracle SQL Developer Tips and Tricks: Data Edition
Oracle SQL Developer Tips and Tricks: Data EditionOracle SQL Developer Tips and Tricks: Data Edition
Oracle SQL Developer Tips and Tricks: Data EditionJeff Smith
 
Oracle Text in APEX
Oracle Text in APEXOracle Text in APEX
Oracle Text in APEXScott Wesley
 

What's hot (20)

Apex Trigger Debugging: Solving the Hard Problems
Apex Trigger Debugging: Solving the Hard ProblemsApex Trigger Debugging: Solving the Hard Problems
Apex Trigger Debugging: Solving the Hard Problems
 
Take a load off! Load testing your Oracle APEX or JDeveloper web applications
Take a load off! Load testing your Oracle APEX or JDeveloper web applicationsTake a load off! Load testing your Oracle APEX or JDeveloper web applications
Take a load off! Load testing your Oracle APEX or JDeveloper web applications
 
O365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin Timmermann
O365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin TimmermannO365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin Timmermann
O365Con18 - Using ARM Templates to Deploy Solutions on Azure - Kevin Timmermann
 
Oracle Application Express
Oracle Application ExpressOracle Application Express
Oracle Application Express
 
Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex code
 
Best practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata APIBest practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata API
 
Develop business apps cross-platform development using visual studio with x...
Develop business apps   cross-platform development using visual studio with x...Develop business apps   cross-platform development using visual studio with x...
Develop business apps cross-platform development using visual studio with x...
 
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEXLOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
LOBS, BLOBS, CLOBS: Dealing with Attachments in APEX
 
Access share point-2013-data-with-provider-hosted-apps
Access share point-2013-data-with-provider-hosted-appsAccess share point-2013-data-with-provider-hosted-apps
Access share point-2013-data-with-provider-hosted-apps
 
Oracle Forms to Apex - OGh - 29 September 2009 - Part 1
Oracle Forms to Apex - OGh - 29 September 2009 - Part 1Oracle Forms to Apex - OGh - 29 September 2009 - Part 1
Oracle Forms to Apex - OGh - 29 September 2009 - Part 1
 
Share point 2013 and sql server 2012 what to choose
Share point 2013 and sql server 2012   what to chooseShare point 2013 and sql server 2012   what to choose
Share point 2013 and sql server 2012 what to choose
 
Oracle APEX or ADF? From Requirements to Tool Choice
Oracle APEX or ADF? From Requirements to Tool ChoiceOracle APEX or ADF? From Requirements to Tool Choice
Oracle APEX or ADF? From Requirements to Tool Choice
 
Oracle Apex Technical Introduction
Oracle Apex   Technical IntroductionOracle Apex   Technical Introduction
Oracle Apex Technical Introduction
 
Acing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointAcing application lifecycle management in SharePoint
Acing application lifecycle management in SharePoint
 
Application express
Application expressApplication express
Application express
 
Web Development In Oracle APEX
Web Development In Oracle APEXWeb Development In Oracle APEX
Web Development In Oracle APEX
 
Oracle SQL Developer - POUG 2018
Oracle SQL Developer - POUG 2018Oracle SQL Developer - POUG 2018
Oracle SQL Developer - POUG 2018
 
Oracle apex training | Oracle Application Application Express Training | Ora...
Oracle apex training | Oracle Application Application Express Training |  Ora...Oracle apex training | Oracle Application Application Express Training |  Ora...
Oracle apex training | Oracle Application Application Express Training | Ora...
 
Oracle SQL Developer Tips and Tricks: Data Edition
Oracle SQL Developer Tips and Tricks: Data EditionOracle SQL Developer Tips and Tricks: Data Edition
Oracle SQL Developer Tips and Tricks: Data Edition
 
Oracle Text in APEX
Oracle Text in APEXOracle Text in APEX
Oracle Text in APEX
 

Similar to Five Enterprise Development Best Practices That EVERY Salesforce Org Can Use

Agile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAgile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAdam Getchell
 
ALM with TFS: From the Drawing Board to the Cloud
ALM with TFS: From the Drawing Board to the CloudALM with TFS: From the Drawing Board to the Cloud
ALM with TFS: From the Drawing Board to the CloudJeremy Likness
 
A Beard, An App, A Blender
A Beard, An App, A BlenderA Beard, An App, A Blender
A Beard, An App, A Blenderedm00se
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing SoftwareSteven Smith
 
Securing Systems at Cloud Scale with DevSecOps
Securing Systems at Cloud Scale with DevSecOpsSecuring Systems at Cloud Scale with DevSecOps
Securing Systems at Cloud Scale with DevSecOpsAmazon Web Services
 
Integration strategies best practices- Mulesoft meetup April 2018
Integration strategies   best practices- Mulesoft meetup April 2018Integration strategies   best practices- Mulesoft meetup April 2018
Integration strategies best practices- Mulesoft meetup April 2018Rohan Rasane
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing SoftwareSteven Smith
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfullyTEST Huddle
 
Putting it All Together: Securing Systems at Cloud Scale
Putting it All Together: Securing Systems at Cloud ScalePutting it All Together: Securing Systems at Cloud Scale
Putting it All Together: Securing Systems at Cloud ScaleAmazon Web Services
 
selenium_course_content.pdf
selenium_course_content.pdfselenium_course_content.pdf
selenium_course_content.pdfaswinisowmiya
 
CodeIgniter for Startups, cicon2010
CodeIgniter for Startups, cicon2010CodeIgniter for Startups, cicon2010
CodeIgniter for Startups, cicon2010Joel Gascoigne
 
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austinDev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austinMatt Tesauro
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald BelchamGetting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham.NET Conf UY
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
TrailblazerDX Motihari.pptx
TrailblazerDX Motihari.pptxTrailblazerDX Motihari.pptx
TrailblazerDX Motihari.pptxOm Prakash
 
Continuous delivery @wcap 5-09-2013
Continuous delivery   @wcap 5-09-2013Continuous delivery   @wcap 5-09-2013
Continuous delivery @wcap 5-09-2013David Funaro
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
Making security-agile matt-tesauro
Making security-agile matt-tesauroMaking security-agile matt-tesauro
Making security-agile matt-tesauroMatt Tesauro
 

Similar to Five Enterprise Development Best Practices That EVERY Salesforce Org Can Use (20)

Agile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAgile Secure Cloud Application Development Management
Agile Secure Cloud Application Development Management
 
ALM with TFS: From the Drawing Board to the Cloud
ALM with TFS: From the Drawing Board to the CloudALM with TFS: From the Drawing Board to the Cloud
ALM with TFS: From the Drawing Board to the Cloud
 
A Beard, An App, A Blender
A Beard, An App, A BlenderA Beard, An App, A Blender
A Beard, An App, A Blender
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
 
Securing Systems at Cloud Scale with DevSecOps
Securing Systems at Cloud Scale with DevSecOpsSecuring Systems at Cloud Scale with DevSecOps
Securing Systems at Cloud Scale with DevSecOps
 
Integration strategies best practices- Mulesoft meetup April 2018
Integration strategies   best practices- Mulesoft meetup April 2018Integration strategies   best practices- Mulesoft meetup April 2018
Integration strategies best practices- Mulesoft meetup April 2018
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing Software
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Putting it All Together: Securing Systems at Cloud Scale
Putting it All Together: Securing Systems at Cloud ScalePutting it All Together: Securing Systems at Cloud Scale
Putting it All Together: Securing Systems at Cloud Scale
 
selenium_course_content.pdf
selenium_course_content.pdfselenium_course_content.pdf
selenium_course_content.pdf
 
Agile testing
Agile testingAgile testing
Agile testing
 
CodeIgniter for Startups, cicon2010
CodeIgniter for Startups, cicon2010CodeIgniter for Startups, cicon2010
CodeIgniter for Startups, cicon2010
 
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austinDev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald BelchamGetting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
TrailblazerDX Motihari.pptx
TrailblazerDX Motihari.pptxTrailblazerDX Motihari.pptx
TrailblazerDX Motihari.pptx
 
Continuous delivery @wcap 5-09-2013
Continuous delivery   @wcap 5-09-2013Continuous delivery   @wcap 5-09-2013
Continuous delivery @wcap 5-09-2013
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Making security-agile matt-tesauro
Making security-agile matt-tesauroMaking security-agile matt-tesauro
Making security-agile matt-tesauro
 

More from Salesforce Developers

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 DevelopersSalesforce 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 PerformanceSalesforce Developers
 
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 ComponentsSalesforce Developers
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsSalesforce Developers
 
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 IndiaSalesforce Developers
 
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 DevelopmentSalesforce Developers
 
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 ComponentsSalesforce Developers
 
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 ComponentsSalesforce Developers
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsSalesforce Developers
 
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 TestingSalesforce Developers
 
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 InteroperabilitySalesforce Developers
 
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 dataSalesforce Developers
 
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 IntroductionSalesforce Developers
 
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 JSQCPSalesforce Developers
 
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 SalesforceSalesforce Developers
 
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 CaptureSalesforce Developers
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DXSalesforce Developers
 
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 ConnectSalesforce Developers
 

More from 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
 

Recently uploaded

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Five Enterprise Development Best Practices That EVERY Salesforce Org Can Use

  • 1. Five Enterprise Best Practices That EVERY Salesforce Org Can Use
  • 2. Vivek M. Chawla Salesforce MVP | Senior Software Engineer, Intuit | @VivekMChawla
  • 3. ​  Best Practices We’ll Cover •  Adopt a standard Coding Style •  Follow trigger best practices •  Follow unit test best practices •  Adopt a version of “Separation of Concerns” •  Adopt specific naming conventions ​  How Each Will Be Presented •  Key benefits •  Adoption challenges •  How to execute •  Demo Overview
  • 4. •  Clean, consistent code •  Easier to understand / maintain •  Demonstrates who is willing to change •  Difficult to know where to start •  Difficult to agree on standards •  Can be like discussing religion! •  Difficult to enforce •  Involve the whole team •  Don’t start from scratch •  Borrow from the best •  Write it down •  Code review Key Benefits Adoption Challenges How to Execute Best Practice #1 ​ Adopt a Coding Style
  • 5. •  Scalable code •  Maintainable code •  Extensible code •  Ensuring every developer knows and understands best practices •  Choosing a “standard” pattern to follow can be challenging •  Refactoring code can be painful (even unwanted) •  Understand the best practices •  Choose a pattern •  Create reference code (ie. templates / boilerplate) •  Leverage code library / snippet tools •  Code review Key Benefits Adoption Challenges How to Execute Best Practice #2 ​ Follow Trigger Best Practices
  • 6. •  Significant improvement to code quality •  Better prevention of regressions •  Faster deployments •  Writing good unit tests is hard •  Payoff is invisible •  Nobody likes writing test classes •  Test classes are often written at the last minute •  Really difficult to enforce •  Learn about the best practices •  Attitude adjustment! •  Consider test-driven development •  Leverage tools like the Force.com Security Scanner •  Code Review Key Benefits Adoption Challenges How to Execute Best Practice #3 ​ Follow Unit Test Best Practices
  • 7. •  Reusable, extensible code •  Easier maintenance •  Greater agility •  Hard to implement •  Confusing (until it’s not!) •  Developer turnover can hinder adoption •  Grab the low-hanging fruit •  Target an “express” version of SOC •  Document it, and get developer acknowledgement •  Naming conventions are critical •  You guessed it...Code Review! Key Benefits Adoption Challenges How to Execute Best Practice #4 ​ Adopt a Version of “Separation of Concerns”
  • 8. Separation of Concerns (High Level) Entrypoint Layer Invocation Layer Service Layer Utility Layer Activities that invoke Apex •  API / UI Based Create/Update/Delete •  Visualforce Page / Component Load •  SFDC Asynchronous Queue, Apex Scheduler •  Visualforce Controllers and Extensions •  Triggers and Trigger Handlers •  Web and Email Services •  Asynchronous and Scheduled Apex •  LeadServices.cls, AccountServices.cls, etc. •  RegistrationServices.cls, CpqServices.cls, etc. •  Utility Classes •  Model / Wrapper Classes •  Selector Classes Domain and Function- specific Business Logic “First Line” of Apex Code Supports the Service Layer
  • 9. Separation of Concerns (Low Level) LeadServices.cls AccountServices.clsContactServices.cls LeadConversionUtil.cls ConvertedLead.clsContactSelector.cls AccountSelector.cls LeadConv.page Apex Scheduler SFDC Asynchronous Queue API Based Create/Edit/Delete Operation UI Based Create/Edit/Delete Operation LeadConvController.cls LeadTrigger.trigger LeadTriggerHandler.cls LeadIntAsync.cls LeadCleanJob.clsLeadIntBatch.cls Entrypoint Layer Service Layer Invocation Layer Utility Layer
  • 10. •  Simplifies implementation of Separation of Concerns •  Code is easier to understand and maintain •  Putting thought into names can encourage better design •  Choosing a standard is hard •  Refactoring metadata names in production is painful •  Difficult to enforce •  Choose standards that make sense to your organization •  Document your standards •  Code review…before deploying to production! Key Benefits Adoption Challenges How to Execute Best Practice #5 ​ Adopt Specific Naming Conventions
  • 11. Apex Class and Trigger Names Functional Type Related Component Related Function Name Suffix Examples Trigger Account.object Trigger AccountTrigger Trigger Handler Account.object TriggerHandler AccountTriggerHandler VF Controller NewAccount.page Controller NewAccountController Service Class Account.object Services AccountServices Utility Class Account.object Identifies duplicate Accounts Util AccountDupeCatcherUtil Web Service (REST) Account.object Exposes specialized Account data tools Rest AccountToolsRest Asynchronous (Future) Account.object Performs asynchronous integration tasks Async AccountIntegrationsAsync Asynchronous (Batch) Account.object Performs high-volume data migration tasks Batch AccountMigrationBatch Scheduled Apex Account.object Performs data cleanup on a regular basis Job AccountCleanupJob
  • 12. ​ Make sure that you... •  Stay consistent •  Keep a list of commonly used abbreviations •  Catch bad names before they go to production Key Considerations When Naming Things
  • 13. •  Starts at the top, but has to be a team effort to be effective in the long term •  Clear, concise, easy to access documentation is key •  When the going gets rough, keep on going •  Persistence is better than perfection! Putting it All Together ​ The Importance of Governance
  • 14. ​ Adopt a Coding Style •  Google’s Java Style Guide ​ Trigger Best Practices •  Force.com Apex Developer’s Guide - Triggers •  Trigger Frameworks and Apex Trigger Best Practices •  The Simple Trigger Pattern (STP) •  GitHub Gists •  GistBox ​ Unit Test Best Practices •  An Introduction to Apex Code Test Methods •  How to Write Good Unit Tests •  Apex Annotations •  Force.com Security Source Scanner ​ Separation of Concerns •  Separation of Concerns – Wikipedia •  Apex Enterprise Patterns – Separation of Concerns •  DF’12 Recording – Applying Enterprise Design Patterns Resources