SlideShare a Scribd company logo
Apex 10 Commandments
James Loghry
Technical Architect, EDL Consulting
@dancinllama
Kevin Poorman
Principle Architect, EDL Consulting
@CodeFriar
James Loghry
Technical Architect
Kevin Poorman
Principle Architect
Safe Harbor
Safe harbor statement under the Private Securities Litigation ReformAct 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 andcustomer 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 resultsand 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 resultsof 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 thatare currently available.
Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Commandments 1-5
Kevin Poorman
#1 Thou Shalt keep thy code Stupid Simple. (Kiss)
#1 Thou Shalt keep thy code Stupid Simple. (Kiss)
#2 Thou shalt not put queries in for loops
#2 Thou shalt not put queries in for loops
#3 Thou shalt not put DML in for loops
#3 Thou shalt not put DML in for loops
#4 Thou shalt only put one trigger per object
#5 Thou shalt not put code in triggers other than calling
methods and managing execution order
Commandments 6-10
James Loghry
#6 Thou shalt have a happy balance
between clicks & code
– “I get an error saying that I’ve reached the maximum number of workflows”
– Triggers that replicate declarative functionality.
• Roll-up summary
• Workflows
• Flow Triggers
Good Salesforce Architectural Design
#7 Thou shalt utilize maps for queries when needed
#8 Thou shalt make use of relationships to reduce
queries wherever possible
#9 Thou shalt aim for 100% test coverage
In general test your methods for:
 Positive effects.
• Given proper input it should act like this.
• Not just happy path, but all logic branches.
 Negative effects.
• Given bad data it should error like this.
 Role/Profile/User effects
 Given a user with X profile and Y role it should act like this.
 Bulkification
• Load 200 or more records to test limits.
#10 Thou shalt write meaningful and useful tests
• Not a test without System.assert calls
• System.assert(A==B)
• System.AssertEquals(A,B)
• System.AssertNotEquals(A,B)
• The more assertions the better.
• Create mock data, never rely on existing production data.
• Test all conditions, not just positive test cases
• Test one criteria per unit test.
#Bonus! Thou shalt feel free to break these as
wisdom merits.
After all:
 Sometimes you just need a list of Id’s
 These commandments, despite their name, are guidelines for success,
not syntactical rules you just can’t break.
 Break them if you need to, Adhere if you can – they’ll save you time in
the long run.
Questions & Answers
Apex 10 commandments df14

More Related Content

What's hot

Salesforce Known Issues: The Lifecycle of a Bug
Salesforce Known Issues: The Lifecycle of a BugSalesforce Known Issues: The Lifecycle of a Bug
Salesforce Known Issues: The Lifecycle of a Bug
Salesforce Developers
 
Increase Customer Adoption with Interactive Content
Increase Customer Adoption with Interactive ContentIncrease Customer Adoption with Interactive Content
Increase Customer Adoption with Interactive Content
Gavin Austin
 
Einstein Analytics for Developers
Einstein Analytics for DevelopersEinstein Analytics for Developers
Einstein Analytics for Developers
Salesforce Developers
 
Easy No-Code Integrations with External Services and Visual Flow
Easy No-Code Integrations with External Services and Visual FlowEasy No-Code Integrations with External Services and Visual Flow
Easy No-Code Integrations with External Services and Visual Flow
Salesforce Developers
 
Content Strategy Workshop: TC Camp 2016
Content Strategy Workshop: TC Camp 2016Content Strategy Workshop: TC Camp 2016
Content Strategy Workshop: TC Camp 2016
Gavin Austin
 
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam BarnetSandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Salesforce Admins
 
Startups need Admins, too
Startups need Admins, tooStartups need Admins, too
Startups need Admins, too
Salesforce Admins
 
How Writers Can Benefit from Social Software
How Writers Can Benefit from Social SoftwareHow Writers Can Benefit from Social Software
How Writers Can Benefit from Social Software
Gavin Austin
 
Make Apps Smarter with Einstein
Make Apps Smarter with EinsteinMake Apps Smarter with Einstein
Make Apps Smarter with Einstein
Salesforce Admins
 
If You Can Imagine It, an #AwesomeAdmin Can Do It
If You Can Imagine It, an #AwesomeAdmin Can Do ItIf You Can Imagine It, an #AwesomeAdmin Can Do It
If You Can Imagine It, an #AwesomeAdmin Can Do It
Salesforce Admins
 
Introduction to Flow
Introduction to FlowIntroduction to Flow
Introduction to Flow
Salesforce Admins
 
Five Steps to Effective, Efficient and Evolutionary Process Flows
Five Steps to Effective, Efficient and Evolutionary Process FlowsFive Steps to Effective, Efficient and Evolutionary Process Flows
Five Steps to Effective, Efficient and Evolutionary Process Flows
Salesforce Admins
 
A Beginner's Guide to Lightning Components by Niels Bryna-Low
A Beginner's Guide to Lightning Components by Niels Bryna-LowA Beginner's Guide to Lightning Components by Niels Bryna-Low
A Beginner's Guide to Lightning Components by Niels Bryna-Low
Salesforce Admins
 
The Salesforce Einstein Product Team: Ask Us Anything!
The Salesforce Einstein Product Team: Ask Us Anything!The Salesforce Einstein Product Team: Ask Us Anything!
The Salesforce Einstein Product Team: Ask Us Anything!
Salesforce Developers
 
Doc is Dead! How Walkthroughs Changed Salesforce's Content Strategy
Doc is Dead! How Walkthroughs Changed Salesforce's Content StrategyDoc is Dead! How Walkthroughs Changed Salesforce's Content Strategy
Doc is Dead! How Walkthroughs Changed Salesforce's Content Strategy
Gavin Austin
 
Salesforce at Continuous Delivery Foundation Summit
Salesforce at Continuous Delivery Foundation SummitSalesforce at Continuous Delivery Foundation Summit
Salesforce at Continuous Delivery Foundation Summit
Mark Interrante
 
Salesforce Labs - Hidden Gems on the AppExchange
Salesforce Labs - Hidden Gems on the AppExchangeSalesforce Labs - Hidden Gems on the AppExchange
Salesforce Labs - Hidden Gems on the AppExchange
Samuel Moyson
 
6 Reporting Formulas That Will Delight Your Users
6 Reporting FormulasThat Will Delight Your Users6 Reporting FormulasThat Will Delight Your Users
6 Reporting Formulas That Will Delight Your Users
Salesforce Admins
 
Building first lightning component at udaipur admin group session
Building first lightning component at udaipur admin group sessionBuilding first lightning component at udaipur admin group session
Building first lightning component at udaipur admin group session
Avanish Kumar
 
How to Build an AppExchange Strategy
How to Build an AppExchange StrategyHow to Build an AppExchange Strategy
How to Build an AppExchange Strategy
Salesforce Admins
 

What's hot (20)

Salesforce Known Issues: The Lifecycle of a Bug
Salesforce Known Issues: The Lifecycle of a BugSalesforce Known Issues: The Lifecycle of a Bug
Salesforce Known Issues: The Lifecycle of a Bug
 
Increase Customer Adoption with Interactive Content
Increase Customer Adoption with Interactive ContentIncrease Customer Adoption with Interactive Content
Increase Customer Adoption with Interactive Content
 
Einstein Analytics for Developers
Einstein Analytics for DevelopersEinstein Analytics for Developers
Einstein Analytics for Developers
 
Easy No-Code Integrations with External Services and Visual Flow
Easy No-Code Integrations with External Services and Visual FlowEasy No-Code Integrations with External Services and Visual Flow
Easy No-Code Integrations with External Services and Visual Flow
 
Content Strategy Workshop: TC Camp 2016
Content Strategy Workshop: TC Camp 2016Content Strategy Workshop: TC Camp 2016
Content Strategy Workshop: TC Camp 2016
 
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam BarnetSandboxes: The Future of App Development by Evan Barnet & Pam Barnet
Sandboxes: The Future of App Development by Evan Barnet & Pam Barnet
 
Startups need Admins, too
Startups need Admins, tooStartups need Admins, too
Startups need Admins, too
 
How Writers Can Benefit from Social Software
How Writers Can Benefit from Social SoftwareHow Writers Can Benefit from Social Software
How Writers Can Benefit from Social Software
 
Make Apps Smarter with Einstein
Make Apps Smarter with EinsteinMake Apps Smarter with Einstein
Make Apps Smarter with Einstein
 
If You Can Imagine It, an #AwesomeAdmin Can Do It
If You Can Imagine It, an #AwesomeAdmin Can Do ItIf You Can Imagine It, an #AwesomeAdmin Can Do It
If You Can Imagine It, an #AwesomeAdmin Can Do It
 
Introduction to Flow
Introduction to FlowIntroduction to Flow
Introduction to Flow
 
Five Steps to Effective, Efficient and Evolutionary Process Flows
Five Steps to Effective, Efficient and Evolutionary Process FlowsFive Steps to Effective, Efficient and Evolutionary Process Flows
Five Steps to Effective, Efficient and Evolutionary Process Flows
 
A Beginner's Guide to Lightning Components by Niels Bryna-Low
A Beginner's Guide to Lightning Components by Niels Bryna-LowA Beginner's Guide to Lightning Components by Niels Bryna-Low
A Beginner's Guide to Lightning Components by Niels Bryna-Low
 
The Salesforce Einstein Product Team: Ask Us Anything!
The Salesforce Einstein Product Team: Ask Us Anything!The Salesforce Einstein Product Team: Ask Us Anything!
The Salesforce Einstein Product Team: Ask Us Anything!
 
Doc is Dead! How Walkthroughs Changed Salesforce's Content Strategy
Doc is Dead! How Walkthroughs Changed Salesforce's Content StrategyDoc is Dead! How Walkthroughs Changed Salesforce's Content Strategy
Doc is Dead! How Walkthroughs Changed Salesforce's Content Strategy
 
Salesforce at Continuous Delivery Foundation Summit
Salesforce at Continuous Delivery Foundation SummitSalesforce at Continuous Delivery Foundation Summit
Salesforce at Continuous Delivery Foundation Summit
 
Salesforce Labs - Hidden Gems on the AppExchange
Salesforce Labs - Hidden Gems on the AppExchangeSalesforce Labs - Hidden Gems on the AppExchange
Salesforce Labs - Hidden Gems on the AppExchange
 
6 Reporting Formulas That Will Delight Your Users
6 Reporting FormulasThat Will Delight Your Users6 Reporting FormulasThat Will Delight Your Users
6 Reporting Formulas That Will Delight Your Users
 
Building first lightning component at udaipur admin group session
Building first lightning component at udaipur admin group sessionBuilding first lightning component at udaipur admin group session
Building first lightning component at udaipur admin group session
 
How to Build an AppExchange Strategy
How to Build an AppExchange StrategyHow to Build an AppExchange Strategy
How to Build an AppExchange Strategy
 

Viewers also liked

HFE: The Ultimate Guide to Prenatal Exercise
HFE: The Ultimate Guide to Prenatal ExerciseHFE: The Ultimate Guide to Prenatal Exercise
HFE: The Ultimate Guide to Prenatal Exercise
Inbound Digital
 
114 i quesiti sul decreto 81 le sanzioni per gli accordi formativi
114   i quesiti sul decreto 81  le sanzioni per gli accordi formativi114   i quesiti sul decreto 81  le sanzioni per gli accordi formativi
114 i quesiti sul decreto 81 le sanzioni per gli accordi formativihttp://www.studioingvolpi.it
 
Η εποχή της ακμής
Η εποχή της ακμήςΗ εποχή της ακμής
Η εποχή της ακμής
4gymsch
 
Ionic on visualforce and sf1 df14
Ionic on visualforce and sf1   df14Ionic on visualforce and sf1   df14
Ionic on visualforce and sf1 df14
Kevin Poorman
 
Final assessment
Final assessmentFinal assessment
Final assessment
Prakash Subedi
 
Rs 12.03.2013
Rs 12.03.2013 Rs 12.03.2013
Rs 12.03.2013 gherardini
 
Wrought iron fence installation
Wrought iron fence installationWrought iron fence installation
Wrought iron fence installationalfredmcguire01
 
Watter®: safe, sustainable disinfection for the hatchery sector
Watter®: safe, sustainable disinfection for the hatchery sectorWatter®: safe, sustainable disinfection for the hatchery sector
Watter®: safe, sustainable disinfection for the hatchery sector
Henry Arts
 
Lecture 9:Placebo outline Dr.Anna
Lecture 9:Placebo outline Dr.Anna Lecture 9:Placebo outline Dr.Anna
Lecture 9:Placebo outline Dr.Anna AHS_student
 
社長インタビュー(ネットイヤーグループ株式会社)
社長インタビュー(ネットイヤーグループ株式会社)社長インタビュー(ネットイヤーグループ株式会社)
社長インタビュー(ネットイヤーグループ株式会社)東証ソーシャルかぶコン
 
3739 barry ave listed by rick page
3739 barry ave listed by rick page3739 barry ave listed by rick page
3739 barry ave listed by rick page
Rick Pack
 
Ioannina Art and Landscpe - Greece
Ioannina Art and Landscpe - GreeceIoannina Art and Landscpe - Greece
Ioannina Art and Landscpe - Greece
Italianostratrasimeno
 
Blog
BlogBlog
Ensuring a successful implementation of your MNP projects
Ensuring a successful implementation of your MNP projectsEnsuring a successful implementation of your MNP projects
Ensuring a successful implementation of your MNP projectsBSP Media Group
 
Ηράκλειος
ΗράκλειοςΗράκλειος
Ηράκλειος
4gymsch
 
Finding a good development partner
Finding a good development partnerFinding a good development partner
Finding a good development partner
Kevin Poorman
 

Viewers also liked (18)

50320140502001 2
50320140502001 250320140502001 2
50320140502001 2
 
HFE: The Ultimate Guide to Prenatal Exercise
HFE: The Ultimate Guide to Prenatal ExerciseHFE: The Ultimate Guide to Prenatal Exercise
HFE: The Ultimate Guide to Prenatal Exercise
 
114 i quesiti sul decreto 81 le sanzioni per gli accordi formativi
114   i quesiti sul decreto 81  le sanzioni per gli accordi formativi114   i quesiti sul decreto 81  le sanzioni per gli accordi formativi
114 i quesiti sul decreto 81 le sanzioni per gli accordi formativi
 
Η εποχή της ακμής
Η εποχή της ακμήςΗ εποχή της ακμής
Η εποχή της ακμής
 
Ionic on visualforce and sf1 df14
Ionic on visualforce and sf1   df14Ionic on visualforce and sf1   df14
Ionic on visualforce and sf1 df14
 
Final assessment
Final assessmentFinal assessment
Final assessment
 
Rs 12.03.2013
Rs 12.03.2013 Rs 12.03.2013
Rs 12.03.2013
 
Wrought iron fence installation
Wrought iron fence installationWrought iron fence installation
Wrought iron fence installation
 
Watter®: safe, sustainable disinfection for the hatchery sector
Watter®: safe, sustainable disinfection for the hatchery sectorWatter®: safe, sustainable disinfection for the hatchery sector
Watter®: safe, sustainable disinfection for the hatchery sector
 
Lecture 9:Placebo outline Dr.Anna
Lecture 9:Placebo outline Dr.Anna Lecture 9:Placebo outline Dr.Anna
Lecture 9:Placebo outline Dr.Anna
 
社長インタビュー(ネットイヤーグループ株式会社)
社長インタビュー(ネットイヤーグループ株式会社)社長インタビュー(ネットイヤーグループ株式会社)
社長インタビュー(ネットイヤーグループ株式会社)
 
3739 barry ave listed by rick page
3739 barry ave listed by rick page3739 barry ave listed by rick page
3739 barry ave listed by rick page
 
Ioannina Art and Landscpe - Greece
Ioannina Art and Landscpe - GreeceIoannina Art and Landscpe - Greece
Ioannina Art and Landscpe - Greece
 
115 federlazio accordo-attrezzature
115   federlazio accordo-attrezzature115   federlazio accordo-attrezzature
115 federlazio accordo-attrezzature
 
Blog
BlogBlog
Blog
 
Ensuring a successful implementation of your MNP projects
Ensuring a successful implementation of your MNP projectsEnsuring a successful implementation of your MNP projects
Ensuring a successful implementation of your MNP projects
 
Ηράκλειος
ΗράκλειοςΗράκλειος
Ηράκλειος
 
Finding a good development partner
Finding a good development partnerFinding a good development partner
Finding a good development partner
 

Similar to Apex 10 commandments df14

Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
Salesforce Developers
 
Five Developer Tips Every Admin Needs To Know
Five Developer Tips Every Admin Needs To KnowFive Developer Tips Every Admin Needs To Know
Five Developer Tips Every Admin Needs To Know
Salesforce Developers
 
Detroit ELEVATE Track 1
Detroit ELEVATE Track 1Detroit ELEVATE Track 1
Detroit ELEVATE Track 1
Joshua Birk
 
iOS Unit Testing Like a Boss
iOS Unit Testing Like a BossiOS Unit Testing Like a Boss
iOS Unit Testing Like a Boss
Salesforce Developers
 
Unleash the Power of Apex Realtime Debugger
Unleash the Power of Apex Realtime DebuggerUnleash the Power of Apex Realtime Debugger
Unleash the Power of Apex Realtime Debugger
Salesforce Developers
 
How to Optimize Your AppExchange Listing
How to Optimize Your AppExchange ListingHow to Optimize Your AppExchange Listing
How to Optimize Your AppExchange Listing
Eric Wu
 
Df14 Building Machine Learning Systems with Apex
Df14 Building Machine Learning Systems with ApexDf14 Building Machine Learning Systems with Apex
Df14 Building Machine Learning Systems with Apex
pbattisson
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
Salesforce Developers
 
Building Mobile Apps That Deliver Salesforce to Your Employees
Building Mobile Apps That Deliver Salesforce to Your EmployeesBuilding Mobile Apps That Deliver Salesforce to Your Employees
Building Mobile Apps That Deliver Salesforce to Your Employees
Salesforce Developers
 
Introduction to Force.com
Introduction to Force.comIntroduction to Force.com
Introduction to Force.com
Salesforce Developers
 
Salesforce Partner Forum: The Internet of Things Opportunity
Salesforce Partner Forum: The Internet of Things OpportunitySalesforce Partner Forum: The Internet of Things Opportunity
Salesforce Partner Forum: The Internet of Things Opportunity
ReidCarlberg
 
The Ideal Salesforce Development Lifecycle
The Ideal Salesforce Development LifecycleThe Ideal Salesforce Development Lifecycle
The Ideal Salesforce Development Lifecycle
Joshua Hoskins
 
Get the YES - Davina Hanchuck
Get the YES - Davina HanchuckGet the YES - Davina Hanchuck
Get the YES - Davina Hanchuck
Salesforce Admins
 
Build Together And Deliver Continuously With Salesforce DX
Build Together And Deliver Continuously With Salesforce DXBuild Together And Deliver Continuously With Salesforce DX
Build Together And Deliver Continuously With Salesforce DX
Lynette Lim
 
Lightning Fast Tips For Your Lightning Roll Out by Kim Schaefges, Nicole Dams...
Lightning Fast Tips For Your Lightning Roll Out by Kim Schaefges, Nicole Dams...Lightning Fast Tips For Your Lightning Roll Out by Kim Schaefges, Nicole Dams...
Lightning Fast Tips For Your Lightning Roll Out by Kim Schaefges, Nicole Dams...
Salesforce Admins
 
S1 Tour Paris Developpeurs
S1 Tour Paris DeveloppeursS1 Tour Paris Developpeurs
S1 Tour Paris Developpeurs
Peter Chittum
 
Gesture Controlled Interactions with Platform Events and IoT Explorer
Gesture Controlled Interactions with Platform Events and IoT ExplorerGesture Controlled Interactions with Platform Events and IoT Explorer
Gesture Controlled Interactions with Platform Events and IoT Explorer
Salesforce Developers
 
Bulkify Your Org
Bulkify Your OrgBulkify Your Org
Bulkify Your Org
Salesforce Developers
 
Developing Interactive Tables and Charts in Visualforce
Developing Interactive Tables and Charts in VisualforceDeveloping Interactive Tables and Charts in Visualforce
Developing Interactive Tables and Charts in Visualforce
Salesforce Developers
 

Similar to Apex 10 commandments df14 (20)

Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Five Developer Tips Every Admin Needs To Know
Five Developer Tips Every Admin Needs To KnowFive Developer Tips Every Admin Needs To Know
Five Developer Tips Every Admin Needs To Know
 
Elevate workshop track1
Elevate workshop track1Elevate workshop track1
Elevate workshop track1
 
Detroit ELEVATE Track 1
Detroit ELEVATE Track 1Detroit ELEVATE Track 1
Detroit ELEVATE Track 1
 
iOS Unit Testing Like a Boss
iOS Unit Testing Like a BossiOS Unit Testing Like a Boss
iOS Unit Testing Like a Boss
 
Unleash the Power of Apex Realtime Debugger
Unleash the Power of Apex Realtime DebuggerUnleash the Power of Apex Realtime Debugger
Unleash the Power of Apex Realtime Debugger
 
How to Optimize Your AppExchange Listing
How to Optimize Your AppExchange ListingHow to Optimize Your AppExchange Listing
How to Optimize Your AppExchange Listing
 
Df14 Building Machine Learning Systems with Apex
Df14 Building Machine Learning Systems with ApexDf14 Building Machine Learning Systems with Apex
Df14 Building Machine Learning Systems with Apex
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Building Mobile Apps That Deliver Salesforce to Your Employees
Building Mobile Apps That Deliver Salesforce to Your EmployeesBuilding Mobile Apps That Deliver Salesforce to Your Employees
Building Mobile Apps That Deliver Salesforce to Your Employees
 
Introduction to Force.com
Introduction to Force.comIntroduction to Force.com
Introduction to Force.com
 
Salesforce Partner Forum: The Internet of Things Opportunity
Salesforce Partner Forum: The Internet of Things OpportunitySalesforce Partner Forum: The Internet of Things Opportunity
Salesforce Partner Forum: The Internet of Things Opportunity
 
The Ideal Salesforce Development Lifecycle
The Ideal Salesforce Development LifecycleThe Ideal Salesforce Development Lifecycle
The Ideal Salesforce Development Lifecycle
 
Get the YES - Davina Hanchuck
Get the YES - Davina HanchuckGet the YES - Davina Hanchuck
Get the YES - Davina Hanchuck
 
Build Together And Deliver Continuously With Salesforce DX
Build Together And Deliver Continuously With Salesforce DXBuild Together And Deliver Continuously With Salesforce DX
Build Together And Deliver Continuously With Salesforce DX
 
Lightning Fast Tips For Your Lightning Roll Out by Kim Schaefges, Nicole Dams...
Lightning Fast Tips For Your Lightning Roll Out by Kim Schaefges, Nicole Dams...Lightning Fast Tips For Your Lightning Roll Out by Kim Schaefges, Nicole Dams...
Lightning Fast Tips For Your Lightning Roll Out by Kim Schaefges, Nicole Dams...
 
S1 Tour Paris Developpeurs
S1 Tour Paris DeveloppeursS1 Tour Paris Developpeurs
S1 Tour Paris Developpeurs
 
Gesture Controlled Interactions with Platform Events and IoT Explorer
Gesture Controlled Interactions with Platform Events and IoT ExplorerGesture Controlled Interactions with Platform Events and IoT Explorer
Gesture Controlled Interactions with Platform Events and IoT Explorer
 
Bulkify Your Org
Bulkify Your OrgBulkify Your Org
Bulkify Your Org
 
Developing Interactive Tables and Charts in Visualforce
Developing Interactive Tables and Charts in VisualforceDeveloping Interactive Tables and Charts in Visualforce
Developing Interactive Tables and Charts in Visualforce
 

More from Kevin Poorman

10 Principles of Apex Testing
10 Principles of Apex Testing10 Principles of Apex Testing
10 Principles of Apex TestingKevin Poorman
 
10 principles of apex testing
10 principles of apex testing10 principles of apex testing
10 principles of apex testing
Kevin Poorman
 
Mac gyver df14 - final
Mac gyver   df14 - finalMac gyver   df14 - final
Mac gyver df14 - final
Kevin Poorman
 
Ci of js and apex using jasmine, phantom js and drone io df14
Ci of js and apex using jasmine, phantom js and drone io   df14Ci of js and apex using jasmine, phantom js and drone io   df14
Ci of js and apex using jasmine, phantom js and drone io df14
Kevin Poorman
 
Apex for humans
Apex for humansApex for humans
Apex for humans
Kevin Poorman
 
Connecting with the enterprise - The how and why of connecting to Enterprise ...
Connecting with the enterprise - The how and why of connecting to Enterprise ...Connecting with the enterprise - The how and why of connecting to Enterprise ...
Connecting with the enterprise - The how and why of connecting to Enterprise ...
Kevin Poorman
 

More from Kevin Poorman (6)

10 Principles of Apex Testing
10 Principles of Apex Testing10 Principles of Apex Testing
10 Principles of Apex Testing
 
10 principles of apex testing
10 principles of apex testing10 principles of apex testing
10 principles of apex testing
 
Mac gyver df14 - final
Mac gyver   df14 - finalMac gyver   df14 - final
Mac gyver df14 - final
 
Ci of js and apex using jasmine, phantom js and drone io df14
Ci of js and apex using jasmine, phantom js and drone io   df14Ci of js and apex using jasmine, phantom js and drone io   df14
Ci of js and apex using jasmine, phantom js and drone io df14
 
Apex for humans
Apex for humansApex for humans
Apex for humans
 
Connecting with the enterprise - The how and why of connecting to Enterprise ...
Connecting with the enterprise - The how and why of connecting to Enterprise ...Connecting with the enterprise - The how and why of connecting to Enterprise ...
Connecting with the enterprise - The how and why of connecting to Enterprise ...
 

Recently uploaded

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 

Recently uploaded (20)

Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 

Apex 10 commandments df14

  • 1. Apex 10 Commandments James Loghry Technical Architect, EDL Consulting @dancinllama Kevin Poorman Principle Architect, EDL Consulting @CodeFriar
  • 4. Safe Harbor Safe harbor statement under the Private Securities Litigation ReformAct 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 andcustomer 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 resultsand 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 resultsof 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 thatare currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  • 6. #1 Thou Shalt keep thy code Stupid Simple. (Kiss)
  • 7. #1 Thou Shalt keep thy code Stupid Simple. (Kiss)
  • 8. #2 Thou shalt not put queries in for loops
  • 9. #2 Thou shalt not put queries in for loops
  • 10. #3 Thou shalt not put DML in for loops
  • 11. #3 Thou shalt not put DML in for loops
  • 12. #4 Thou shalt only put one trigger per object
  • 13. #5 Thou shalt not put code in triggers other than calling methods and managing execution order
  • 15. #6 Thou shalt have a happy balance between clicks & code – “I get an error saying that I’ve reached the maximum number of workflows” – Triggers that replicate declarative functionality. • Roll-up summary • Workflows • Flow Triggers Good Salesforce Architectural Design
  • 16. #7 Thou shalt utilize maps for queries when needed
  • 17. #8 Thou shalt make use of relationships to reduce queries wherever possible
  • 18. #9 Thou shalt aim for 100% test coverage In general test your methods for:  Positive effects. • Given proper input it should act like this. • Not just happy path, but all logic branches.  Negative effects. • Given bad data it should error like this.  Role/Profile/User effects  Given a user with X profile and Y role it should act like this.  Bulkification • Load 200 or more records to test limits.
  • 19. #10 Thou shalt write meaningful and useful tests • Not a test without System.assert calls • System.assert(A==B) • System.AssertEquals(A,B) • System.AssertNotEquals(A,B) • The more assertions the better. • Create mock data, never rely on existing production data. • Test all conditions, not just positive test cases • Test one criteria per unit test.
  • 20.
  • 21.
  • 22.
  • 23. #Bonus! Thou shalt feel free to break these as wisdom merits. After all:  Sometimes you just need a list of Id’s  These commandments, despite their name, are guidelines for success, not syntactical rules you just can’t break.  Break them if you need to, Adhere if you can – they’ll save you time in the long run.

Editor's Notes

  1. Key Takeaway: We are a publicly traded company. Please make your buying decisions only on the products commercially available from Salesforce.com. Talk Track: Before I begin, just a quick note that when considering future developments, whether by us or with any other solution provider, you should always base your purchasing decisions on what is currently available.
  2. DEMO: Showing developer console Executing code and showing error List<Account> accLst = new List<Account>([SELECT Id, Name FROM Account LIMIT 100]); for (Account acc : accLst){ Integer numWithEmail = 0; List<Contact> contactLst = new List<Contact>([SELECT Id, Email FROM Contact WHERE AccountId = :acc.Id]); for (Contact cont : contactLst){ if (Cont.Email != null){ numWithEmail++; } } System.debug(acc.Name+' has '+numWithEmail+' contacts with emails'); } Make sure log levels are: DB: Info Callouts : Error Apex Code: Debug Validation: Error Workflow: Error Profilng: Debug Visualforce: Error System: Error
  3. DEMO: Change code in developer console. Show debug log with now a query limit of 1. List<Account> accLst = new List<Account>([SELECT Id, Name, (SELECT Id, Email FROM Contacts) FROM Account LIMIT 100]); for (Account acc : accLst){ Integer numWithEmail = 0; for (Contact cont : acc.Contacts){ if (Cont.Email != null){ numWithEmail++; } } System.debug(acc.Name+' has '+numWithEmail+' contacts with emails'); }
  4. DEMO: Showing developer console Executing code and showing error List<Account> accLst = new List<Account>([SELECT Id, Name FROM Account LIMIT 100]); for (Account acc : accLst){ Integer numWithEmail = 0; List<Contact> contactLst = new List<Contact>([SELECT Id, Email FROM Contact WHERE AccountId = :acc.Id]); for (Contact cont : contactLst){ if (Cont.Email != null){ numWithEmail++; } } System.debug(acc.Name+' has '+numWithEmail+' contacts with emails'); } Make sure log levels are: DB: Info Callouts : Error Apex Code: Debug Validation: Error Workflow: Error Profilng: Debug Visualforce: Error System: Error
  5. DEMO: Change code in developer console. Show debug log with now a query limit of 1. List<Account> accLst = new List<Account>([SELECT Id, Name, (SELECT Id, Email FROM Contacts) FROM Account LIMIT 100]); for (Account acc : accLst){ Integer numWithEmail = 0; for (Contact cont : acc.Contacts){ if (Cont.Email != null){ numWithEmail++; } } System.debug(acc.Name+' has '+numWithEmail+' contacts with emails'); }
  6. DEMO: Showing developer console Executing code and showing error List<Account> accLst = new List<Account>([SELECT Id, Name, Contacts_with_Email_Address__c, (SELECT Id, Email FROM Contacts) FROM Account LIMIT 151]); for (Account acc : accLst){ Integer numWithEmail = 0; for (Contact cont : acc.Contacts){ if (Cont.Email != null){ numWithEmail++; } } System.debug(acc.Name+' has '+numWithEmail+' contacts with emails'); acc.Contacts_with_Email_Address__c = numWithEmail; update acc; }
  7. List<Account> accLst = new List<Account>([SELECT Id, Name, Contacts_with_Email_Address__c, (SELECT Id, Email FROM Contacts) FROM Account LIMIT 151]); List<Account> accToUpd = new List<Account>(); for (Account acc : accLst){ Integer numWithEmail = 0; for (Contact cont : acc.Contacts){ if (Cont.Email != null){ numWithEmail++; } } System.debug(acc.Name+' has '+numWithEmail+' contacts with emails'); if (acc.Contacts_with_Email_Address__c <> numWithEmail){ acc.Contacts_with_Email_Address__c = numWithEmail; accToUpd.add(acc); } } update accToUpd;
  8. Declarative crazy. 500+ fields on an object, loads of workflows – It can get really hard to see what’s going on in the same way bad coding can be hard.
  9. When querying for a collection of records, you can query into either a list or a map. By default it seems we all learn to query into a list, like we see there in the first block of code. In complex logic situations the ability to pull from the collection a specific record, by it’s id is essential. In refactoring situations it’s easy to convert your list to a map (line 10)
  10. Queries are limited. Use your queries wisely, and remember to query UP. Start with the childmost object and reference parent objects through the relationship __r fields
  11. Positive Test cases should check for expected results not only of the unit overall but of logic branches.
  12. As a consultant, I often inherit orgs that, at first glance contain great test coverage. Just because it gives you code coverage results doesn’t mean it’s a test But on deeper inspection I realize that the test methods simply execute the code in question. Just executing your code within a Test class, doesn’t do anything to prove that your code works. Use the System.assert(), System.AssertEquals() and System.AssertNotEquals() methods You can assert Record Counts, object properties, in fact you should assert the
  13. Positive Test Case Mock Data Setup
  14. Exception test scenario
  15. Negative test scenario