O'Reilly logo

Mastering Application Development with Force.com by Kevin J. Poorman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Code reviews – pointed questions for Apex code review

Let's get started with the following set of questions:

  • Does this unit of code have more than four if statements?

    Methods with more than four if statements (if(), else if(), else()) pose a number of related problems. First, due to the verbosity of Apex, numerous if statements will necessarily mean longer methods. Second, because each statement creates another logical path through the method, each also represents at least one additional test case to be written. The fewer the number of logical paths through your code, the simpler it is to understand, test, and refactor. Unfortunately, sometimes the business logic we are calculating requires a number of conditionals. For instance, calculating tax ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required