Show Menu
Cheatography

Naming Conventions and Coding Standards Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Structure

Does the code conform to the coding standards?
Is the code well-s­tru­ctured, consisten in style, and consis­tently formatted?
Are there any uncalled or unneeded procedures or unreac­hable or commented code?
Are there any leftover stubs or test routines in the code?
Can any code be replaced by calls to external reusable compon­ents?
Are there any blocks of repeated code that could be condensed into a single procedure?
Are any modules excess­ivley complex and should be restru­ctured?
Are names of artifacts consis­tent?

Docume­ntation

Is the code clearly and adequately docume­nted?
Is the comment format­/style consistent across the code?
Are unnece­ssary system.debug calls in the code?
Are the methods including a descri­ption, @param & @return?

Variables

Are all variables properly defined with meanin­gful, consis­tent, and clear names?
Is the Java capita­liz­ation (camel­Case) standard used?
Are there any redundant or unused variables?
Are all the variables correctly initia­lized?
Arithmetic operations
Are divisors tested for zero or noise?

Loops

Are loop termin­ation conditions obvious and invariably achiev­able?
Are indexes or subscripts properly initia­lized, just prior to the loop?
Can any statements that are enclosed within loops be placed outside the loops?
Are DML operations placed inside a loop?
Are SOQL or SOSL queries palced inside a loop?
Are future method invoca­tions placed inside a loop?
Are Describe methods invoked inside a loop?
Are emails sent from a loop?
Are Batch Apex jobs executed from a loop?
Are methods invoked from a loop that end up making a query, dml operation, sending an email, invoking a async method?

Data Access & Manipu­lation

Are methods bulkified?
Does the code provide a proper exception handler?
Does the code prevent SOQL and SOSL injection attacks by using static queries, binding variables or the escape­Sin­gle­Quotes method?
Does the code use the enhanced SOQL for loop to query larg data sets?
Are IDs hardcoded?
Is record type inform­ation accessed by making queries?
When usign custom settings, are custom settings validated for null values?
Are queries returning a single record instead of a list?
Are checks to avoid null pointer exceptions performed?
Are indexes properly used when accessing collec­tions (to avoid index out of bounds except­ion)?

Triggers

Are triggers bulkified?
Do triggers have logic inside?
Are there more than one trigger per object?
Does the code have valida­tions to execute the code under the right condit­ions?

Visual­force

Is the DOM id property defined for all elements?
Is there any inline javasc­ript?
Is there any inline CSS?
Are javaScript or CSS in the page?
Are there any lists displayed in the page that may impact the view state?

Contro­llers

Is there any SOQL or SOSL query inside the contro­ller?