SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Finding a good development partner
Kevin Poorman
Principle Architect
@CodeFriar
Kevin Poorman
Principal Architect
Agenda
•Why you need a good development partner
•Terms and Conditions
•What to look for in your partner and in the code
•Questions, Comments and Snide Remarks
Why do you need a good development partner?
•Strategy v. Tactics
•Code is strategic by nature.
•Cost of maintaining code is always the largest expense
of a software project. (cf. Code Complete, by Steve McConnell)
•In other words, you want a developer who writes code
as if the person who ends up maintaining it is a violent
psychopath who knows where they live.
Terms and Conditions
•Single Framework Structure
•Test Coverage
•Assertion
•Comments
Terms and Conditions
Single Framework Structure
SingleTrigger Calls class method(s)
A
Calls class method(s)
B, C and F
Calls class methods
X, Y, and A
Terms and Conditions
Single Framework Structure – Why you want this!
• This allows you to set the order of operations for your trigger code!
• Makes it far easier to test!
• Much easier to follow the code down to where a problem may be
Terms and Conditions
Test Coverage
75% 85% 95%
Minimum
Requirement
to deploy
Rest easy at
night
Psychopath
never looks
up your
address
Terms and Conditions
Assertions
• Until we have Siri in Salesforce, we can’t just ask if our code is working right.
• We use assertions to tell Salesforce what the expected response is
• We could, for instance, assert that Dreamforce14 = Awesome when we run
code that asks is Dreamforce14 Awesome?
• Three Assert methods:
• Assert()
• AssertEquals()
• AssertNotEquals()
Terms and Conditions
Assertions
Tests without Assertions are wasted money. You’ve paid someone to write them
so you can deploy, but their purpose is to prove the code works as expected.
Having tests without asserts is the new buying a picture frame and never
replacing the example family photo that came with it.
Terms and Conditions
Comments – what the what?
• Comments are how developers leave notes to future psychopaths, admins and
anyone else brave enough to venture into the code.
• Two flavors of Apex code comments // & /* */
What to look for in a good development partner
Coding Standard:
Written document describing how the code will be written:
– Good:
• Defines what is to be tested, what “dialect” will be used, and what / how code will be commented
– Better:
• Also describes naming conventions for files, classes and methods
• Provides example comment blocks & establishes rules for a single trigger per object, with all trigger logic in
classes!!
– Best:
• Additionally describes code coverage requirements and specifically mentions that tests will include
positive, negative and permissions based tests.
What to look for in a good development partner
Testing Standard:
Written document describing how the code will be tested:
– Good:
• Defines a minimum requirement of 80% code coverage. (Why 80%? Because you probably inherited some
badly tested code!)
– Better:
• Also requires that all tests generate their own test data and that no tests use @seeAllData
• Enforces no i++ tests
• Increases the minimum code coverage requirement to 85%
– Best:
• Additionally demands that all test methods call at least one Assertion
• Requires a minimum code coverage of 90%
What to look for in a good development partner
Trust but verify
– Your Coding standard should specify naming conventions for files and classes, and as such you
should be able to easily identify your test classes and what they’re testing.
What to look for in a good development partner
Trust but verify
– When reviewing test classes, you should read through them, not necessarily for comprehension,
but to ensure that they are firing assertions.
What to look for in a good development partner
Trust but verify: SeeAllData will hurt you when you least expect it.
– As you can probably imagine, the @seeAllData annotation allows your test to access all the data
in the org you’re running the test in.
– This is a bad thing. (repeat after me) This is a bad thing!
– More often than not, this results in tests *expecting* data to be present in an org.
• If the data is only present in one org… the test will fail in other orgs.
– Instead, each test should create and insert it’s own records.
– Almost never truly needed
What to look for in a good development partner
Trust but verify: Faking Code Coverage
– You can fake code coverage. You shouldn’t. You shouldn’t allow the very concept to be floated in
your presence. This is generally done by creating a class with a method that consists of nothing
but lines incrementing a given variable. Ie: i++; for a long time, follwed by a quick test method
asserting that I = 3000;
– Tar and feather developers you’ve found who do this. It only serves to foster a false sense of
security.
Comments Test Coverage Single Triggers Test Data
Top of Every File 85% or higher aggregate 1 trigger per object
All tests generate their
own Data!
Above every method
85% or higher on all new
classes
Uses an established
Trigger framework
Use a TestFactory Class
Around any complex logic
blocks or apex-shorthand
CodeCoverage report
card with each code
submission
Clear and concise
comments on how triggers
Custom Assertion
methods –
Assertions.recordDidFailV
alidation()
You should be capable of
reading the comments in
the file and following the
flow of data
Verify coverage in the
Developer console.
Trigger logic classes are
bulk tested
Positive, Negative and
Permissions based
testing.
Coding & Testing Standards
My opinionated requirements.
Questions & Answers
If you don’t ask questions … I will.
Questions & Answers
Finding a good development partner

Weitere ähnliche Inhalte

Was ist angesagt?

Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
Jeremy Kendall
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove
 

Was ist angesagt? (20)

Code Review Matters and Manners
Code Review Matters and MannersCode Review Matters and Manners
Code Review Matters and Manners
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Test driven-development
Test driven-developmentTest driven-development
Test driven-development
 
Clean code - Getting your R&D on board
Clean code - Getting your R&D on boardClean code - Getting your R&D on board
Clean code - Getting your R&D on board
 
Unit testing - the hard parts
Unit testing - the hard partsUnit testing - the hard parts
Unit testing - the hard parts
 
Unit tests benefits
Unit tests benefitsUnit tests benefits
Unit tests benefits
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
Working with Legacy Code
Working with Legacy CodeWorking with Legacy Code
Working with Legacy Code
 
Code review
Code reviewCode review
Code review
 
Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
 
How to get the most out of code reviews
How to get the most out of code reviewsHow to get the most out of code reviews
How to get the most out of code reviews
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
TDD That Was Easy!
TDD   That Was Easy!TDD   That Was Easy!
TDD That Was Easy!
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In Action
 
Test Driven Development - Overview and Adoption
Test Driven Development - Overview and AdoptionTest Driven Development - Overview and Adoption
Test Driven Development - Overview and Adoption
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
 
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
 

Ähnlich wie Finding a good development partner

An Introduction to unit testing
An Introduction to unit testingAn Introduction to unit testing
An Introduction to unit testing
Steven Casey
 
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Ortus Solutions, Corp
 
Unit Testing Best Practices
Unit Testing Best PracticesUnit Testing Best Practices
Unit Testing Best Practices
Tomaš Maconko
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
Meilan Ou
 

Ähnlich wie Finding a good development partner (20)

Test Driven Development and Automation
Test Driven Development and AutomationTest Driven Development and Automation
Test Driven Development and Automation
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
An Introduction to unit testing
An Introduction to unit testingAn Introduction to unit testing
An Introduction to unit testing
 
Getting Started with Test-Driven Development at PHPtek 2023
Getting Started with Test-Driven Development at PHPtek 2023Getting Started with Test-Driven Development at PHPtek 2023
Getting Started with Test-Driven Development at PHPtek 2023
 
Beginners overview of automated testing with Rspec
Beginners overview of automated testing with RspecBeginners overview of automated testing with Rspec
Beginners overview of automated testing with Rspec
 
QA and scrum
QA and scrumQA and scrum
QA and scrum
 
Awesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave HaeffnerAwesome Test Automation Made Simple w/ Dave Haeffner
Awesome Test Automation Made Simple w/ Dave Haeffner
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Into...
 
An Introduction To Software Development - Final Review
An Introduction To Software Development - Final ReviewAn Introduction To Software Development - Final Review
An Introduction To Software Development - Final Review
 
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
Introduction to Unit Testing, BDD and Mocking using TestBox & MockBox at Adob...
 
Unit Testing Best Practices
Unit Testing Best PracticesUnit Testing Best Practices
Unit Testing Best Practices
 
Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023Getting Started with Test-Driven Development at Longhorn PHP 2023
Getting Started with Test-Driven Development at Longhorn PHP 2023
 
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
 
Microsoft Fakes, Unit Testing the (almost) Untestable Code
Microsoft Fakes, Unit Testing the (almost) Untestable CodeMicrosoft Fakes, Unit Testing the (almost) Untestable Code
Microsoft Fakes, Unit Testing the (almost) Untestable Code
 
Unit Tests with Microsoft Fakes
Unit Tests with Microsoft FakesUnit Tests with Microsoft Fakes
Unit Tests with Microsoft Fakes
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1
 

Mehr von Kevin Poorman

10 Principles of Apex Testing
10 Principles of Apex Testing10 Principles of Apex Testing
10 Principles of Apex Testing
Kevin Poorman
 

Mehr von Kevin Poorman (8)

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
 
Ionic on visualforce and sf1 df14
Ionic on visualforce and sf1   df14Ionic on visualforce and sf1   df14
Ionic on visualforce and sf1 df14
 
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
 
Apex 10 commandments df14
Apex 10 commandments df14Apex 10 commandments df14
Apex 10 commandments df14
 
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 ...
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Finding a good development partner

  • 1. Finding a good development partner Kevin Poorman Principle Architect @CodeFriar
  • 3. Agenda •Why you need a good development partner •Terms and Conditions •What to look for in your partner and in the code •Questions, Comments and Snide Remarks
  • 4. Why do you need a good development partner? •Strategy v. Tactics •Code is strategic by nature. •Cost of maintaining code is always the largest expense of a software project. (cf. Code Complete, by Steve McConnell) •In other words, you want a developer who writes code as if the person who ends up maintaining it is a violent psychopath who knows where they live.
  • 5. Terms and Conditions •Single Framework Structure •Test Coverage •Assertion •Comments
  • 6. Terms and Conditions Single Framework Structure SingleTrigger Calls class method(s) A Calls class method(s) B, C and F Calls class methods X, Y, and A
  • 7. Terms and Conditions Single Framework Structure – Why you want this! • This allows you to set the order of operations for your trigger code! • Makes it far easier to test! • Much easier to follow the code down to where a problem may be
  • 8. Terms and Conditions Test Coverage 75% 85% 95% Minimum Requirement to deploy Rest easy at night Psychopath never looks up your address
  • 9. Terms and Conditions Assertions • Until we have Siri in Salesforce, we can’t just ask if our code is working right. • We use assertions to tell Salesforce what the expected response is • We could, for instance, assert that Dreamforce14 = Awesome when we run code that asks is Dreamforce14 Awesome? • Three Assert methods: • Assert() • AssertEquals() • AssertNotEquals()
  • 10. Terms and Conditions Assertions Tests without Assertions are wasted money. You’ve paid someone to write them so you can deploy, but their purpose is to prove the code works as expected. Having tests without asserts is the new buying a picture frame and never replacing the example family photo that came with it.
  • 11. Terms and Conditions Comments – what the what? • Comments are how developers leave notes to future psychopaths, admins and anyone else brave enough to venture into the code. • Two flavors of Apex code comments // & /* */
  • 12. What to look for in a good development partner Coding Standard: Written document describing how the code will be written: – Good: • Defines what is to be tested, what “dialect” will be used, and what / how code will be commented – Better: • Also describes naming conventions for files, classes and methods • Provides example comment blocks & establishes rules for a single trigger per object, with all trigger logic in classes!! – Best: • Additionally describes code coverage requirements and specifically mentions that tests will include positive, negative and permissions based tests.
  • 13. What to look for in a good development partner Testing Standard: Written document describing how the code will be tested: – Good: • Defines a minimum requirement of 80% code coverage. (Why 80%? Because you probably inherited some badly tested code!) – Better: • Also requires that all tests generate their own test data and that no tests use @seeAllData • Enforces no i++ tests • Increases the minimum code coverage requirement to 85% – Best: • Additionally demands that all test methods call at least one Assertion • Requires a minimum code coverage of 90%
  • 14. What to look for in a good development partner Trust but verify – Your Coding standard should specify naming conventions for files and classes, and as such you should be able to easily identify your test classes and what they’re testing.
  • 15. What to look for in a good development partner Trust but verify – When reviewing test classes, you should read through them, not necessarily for comprehension, but to ensure that they are firing assertions.
  • 16. What to look for in a good development partner Trust but verify: SeeAllData will hurt you when you least expect it. – As you can probably imagine, the @seeAllData annotation allows your test to access all the data in the org you’re running the test in. – This is a bad thing. (repeat after me) This is a bad thing! – More often than not, this results in tests *expecting* data to be present in an org. • If the data is only present in one org… the test will fail in other orgs. – Instead, each test should create and insert it’s own records. – Almost never truly needed
  • 17. What to look for in a good development partner Trust but verify: Faking Code Coverage – You can fake code coverage. You shouldn’t. You shouldn’t allow the very concept to be floated in your presence. This is generally done by creating a class with a method that consists of nothing but lines incrementing a given variable. Ie: i++; for a long time, follwed by a quick test method asserting that I = 3000; – Tar and feather developers you’ve found who do this. It only serves to foster a false sense of security.
  • 18. Comments Test Coverage Single Triggers Test Data Top of Every File 85% or higher aggregate 1 trigger per object All tests generate their own Data! Above every method 85% or higher on all new classes Uses an established Trigger framework Use a TestFactory Class Around any complex logic blocks or apex-shorthand CodeCoverage report card with each code submission Clear and concise comments on how triggers Custom Assertion methods – Assertions.recordDidFailV alidation() You should be capable of reading the comments in the file and following the flow of data Verify coverage in the Developer console. Trigger logic classes are bulk tested Positive, Negative and Permissions based testing. Coding & Testing Standards My opinionated requirements.
  • 19. Questions & Answers If you don’t ask questions … I will. Questions & Answers

Hinweis der Redaktion

  1. I’m not here to sell you on a particular development partner I’m here because all too often, as a consultant I’m parachuted into an org and asked to help out in an emergency only to find a righteous mess because good meaning people were asked to hire or find development partners who provided code that “worked” (until now) and was relatively inexpensive. I believe as developers, that we have to be better at our craft, and I want to make sure you hire the right people so that you’re not faced with the kind of 11th hour emergencies that require calling in someone like me. If you know what to look for, I believe you can make a solid business case for a slightly more expensive developer partner that writes more maintainable code.
  2. Strategy solves long term problems. You win wars and build businesses with strategy. Tactics, on the other hand, are how you solve short-term problems. Tactical solutions to strategic problems are rarely truly solutions and often disastrous in the long run. Code is strategic by nature. Every line of code in your org is likely to out survive your tenure at the company, and will almost certainty outlive your partners engagement with you. Code has to survive automated testing, release upgrades and the inevitable, if un-often deprecation of features. Because it wouldn’t be code if you could do it another way. Because it’s code, because you’re hiring someone to write the code for you, it *must* be maintainable code.
  3. One of the “best practices” that any org can adopt is the practice of establishing a single trigger per object. For instance a single trigger on Account. The trigger itself contains no logic, it simply exists to fire off a custom class whenever the trigger is fired. The custom class is structured to handle the various contexts like “after insert” and “before delete” and the class method called by the trigger starts off by determining which context to run. Essentially the trigger fires in all actionable contexts and the class handles running the proper code for that context.
  4. Code coverage the term we use to talk about how well our code is tested. When tests are run, Salesforce knows which bits of code have been executed, and can tell you that 50 out of 100 lines have been executed, giving you an embarrassingly low code coverage of 50% Salesforce demands (rightly) that you have 75% code coverage on all classes, and at least SOME code coverage on your triggers to deploy. But with code coverage, as with steaks, the bigger the better.
  5. One of the “best practices” that any org can adopt is the practice of establishing a single trigger per object. For instance a single trigger on Account. The trigger itself contains no logic, it simply exists to fire off a custom class whenever the trigger is fired. The custom class is structured to handle the various contexts like “after insert” and “before delete” and the class method called by the trigger starts off by determining which context to run. Essentially the trigger fires in all actionable contexts and the class handles running the proper code for that context.
  6. First and foremost, you should only hire development partners who have an established coding standard document that you can read, and *understand* before the project begins. You want to be able to provide this documentation to a developer maintaining the code 4, 5 and maybe even 10 years down the road. Don’t loose these, put them in the corporate wiki. Code is understood by contract to not be “complete” until the coding standards are met. This helps ensure your code is consistent!
  7. The Testing standard, while overlapping a little bit with the coding standard, specifically speaks to how your code will be tested. Remember, Badly written tests are more harmful than badly written code. If you believe your code works because the tests pass, but the tests are bad, then you have been setup to fail. Tests that do not call an assertion method are running the code but not testing it to ensure expected behavior. This meets the requirements for deployment within Salesforce, but doesn’t actually prove the code works as intended. Sometimes, you’ll find code specifically written to fake code coverage. This code should be reported immediately and the offenders Named and Shamed on social media. Or tired and feathered, if that’s still legal in your state.
  8. The Testing standard, while overlapping a little bit with the coding standard, specifically speaks to how your code will be tested. Remember, Badly written tests are more harmful than badly written code. If you believe your code works because the tests pass, but the tests are bad, then you have been setup to fail. Tests that do not call an assertion method are running the code but not testing it to ensure expected behavior. This meets the requirements for deployment within Salesforce, but doesn’t actually prove the code works as intended. Sometimes, you’ll find code specifically written to fake code coverage. This code should be reported immediately and the offenders Named and Shamed on social media. Or tired and feathered, if that’s still legal in your state.
  9. The Testing standard, while overlapping a little bit with the coding standard, specifically speaks to how your code will be tested. Remember, Badly written tests are more harmful than badly written code. If you believe your code works because the tests pass, but the tests are bad, then you have been setup to fail. Tests that do not call an assertion method are running the code but not testing it to ensure expected behavior. This meets the requirements for deployment within Salesforce, but doesn’t actually prove the code works as intended. Sometimes, you’ll find code specifically written to fake code coverage. This code should be reported immediately and the offenders Named and Shamed on social media. Or tired and feathered, if that’s still legal in your state.
  10. SteveMoForce hates multi-select picklists. Al Gore isn’t fond of hanging chads. I hate seeAllData=true. More often than not, when I start working on a project or am asked to help figure out why a changeset or deployment is failing … this is what I find! A test using see all data is looking for a specific account, contact or order to manipulate by it’s ID. This fails because even if the objects are otherwise identical, the ID’s for those objects will not be the same in two different orgs. Yay.
  11. You don’t want to see classes that do this!