Lee’s 10 Rules of Apex

I’ve seen a couple versions of rules developers feel are core to good Apex code. I’d like to throw these into the ring as concepts that have been helpful to me, and that I deviate from at my own peril:

  1. Write your tests FIRST
  2. NO hard coded values
  3. Use a test data factory
  4. Test for predictability, not coverage
  5. If it doesn’t assert, it’s not a test
  6. Use a custom error class
  7. Don’t repeat yourself
  8. JS > VF
  9. Don’t repeat yourself
  10. Standard is better than custom (use everything you pay for)

For a different perspective, here’s a DreamForce session that I absolutely agree with.

Posted in Learning