Home » All Blogs » Code review checklist

Code review checklist

In this post we will talk about Salesforce code review checklist and how a customer, Project manager, administrator and developer make sure whether the code written for their uses are followed Apex coding standard as well as avoid vulnerabilities Security issues. Before talking about Apex Best Practices Checklist let see why we need code review?

Why we need Code Review?

Let understand why we need standard and best practices for Code Review?

  1. Project Cost : 40%–80% of the lifetime cost of a piece of software goes to maintenance.
  2. Maintenance : Hardly any software is maintained for its whole life by the original author.
  3. Code readability : Code conventions improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly. Enhance code-readability to anybody wanting to do so in the future reducing efforts for code maintenance
  4. If you ship your source code as a product, you need to make sure it is as well packaged and clean as any other product you create.
  5. Consistency : Introduce consistency to coding practices across length and breadth of implementations.
  6. Code-reusability : Introduce code-reusability to repeatable processes and procedures.
  7. Significantly reduce development time and effort, improving productivity.
  8. Minimize POF’s (point of failure) during implementations.
  9. Tech dept : It help in tech debt prevention.

What is Code Review ?

Code review (sometimes referred to as peer review) is a software quality assurance activity in which one or several people check a program mainly by viewing and reading parts of its source code. At least one of the persons must not be the code’s author. The persons performing the checking are called “reviewers”.

Basic Code Review

Let see what a code reviewers view in code normally

  1. I am able to understand the code?
  2. Is Class/Method is too big ?
  3. DML/SOQL inside for loop
  4. Code coverage is 75+
  5. Code formatting & Naming Conventions
  6. Is code following Standard/ Guidelines.
Basic Code Review

Expert Code Review

Let’s see what an expert code reviewer thinks about doing a code review. Here is the expert level code review checklist.

Expert Code Review in Salesforce

Code review checklist

Here is code review checklist every project should have it.

  1. Is code is following Standard Guidelines
    1. Naming convention in Salesforce
    2. Code Layouts and Formatting Salesforce.
    3. Keep your methods short
    4. Don’t repeat yourself
    5. Methods should do just one thing
  2. Is code following Defined Architecture?
    1. Order of Execution : Be aware of order of executions.
    2. Exception Handling & Logging Framework : Look into logging framework.
    3. Trigger Framework is implemented properly.
  3. Is the code meeting the Non Functional Requirement ?
    1. Is the code Scalable to support huge number of users?
    2. Is the Performance acceptance with hug data?
    3. Is Security taken care?
    4. Is the Code Maintainable easily?
  4. Apex Best Practices : Prefer clicks over code where ever possible
    1. Avoid Hardcoding IDs
    2. Bulkify your Code
    3. No DML/SOQL inside for Loop
    4. Create one Trigger per object
    5. Apex Test class Best Practices
      • Write meaningful tests with asserts.
      • One assert per method.
      • Follow Test Driven Development.
      • Focus on 100% code coverage
      • Writing Test Methods to Verify Large Datasets
      • Use TestDataFactory for data creation.
    6. Utilize Map for queries
    7. Use of the Limits Apex Methods to Avoid Hitting Governor Limits
  5. OOAD ( Object Oriented Analysis & Design)
    1. Separation of Concerns
    2. DRY Principle
    3. SOLID Principle
      • Single-responsibility principle : A piece of logic should only have a single responsibility….and that responsibility should be entirely encapsulated by the class, module or function.
      • Open-closed principle : “Software entities … should be open for extension but closed for modification.”
      • Dependency inversion principle : “Depend on abstractions and not concretions”
    4. Dependency Injection
  6. Static Code Analysis : Use tool to avoid spending to much time on code review which tool can do.
  7. Follow Integration Pattern & Best Practices

Code Review in Salesforce Video

YouTube video

Clean code should follow below best practices

  • Easy to understand by other developers : readable by developers other than the one who developed it.
  • Easy to maintain : lower chances of accidentally introducing bugs
  • Modified without fear of breaking anything : Lot of developers take great pride in making the code compact – trying to do multiple things on one line – which might be impressive, but makes the code much harder to read and understand

Code Review Best Practices

Code review is one of the important process in any software development. It should be properly documented so team can follow code review best practices. Let see some of the code review best practices.

  1. Automate as much as possible using PMD or other tools
  2. Decide on code review goals
  3. Follow a common check list when submitting for review.
  4. During review
    1. Respond in a timely fashion
    2. Set clear expectations
    3. Aim to resolve the review quickly.
  5. Compile your review : Be respectful and frame feedback as request not comments
  6. Be open to follow-up
Code Review Best Practices

Further Learning

If you like this post please add a comment. I would like to have some more tips on this topic. FREE free to add some Tips and best practices in a comment. I will try to add to the post.

Share your love:
Amit Chaudhary
Amit Chaudhary

Amit Chaudhary is Salesforce Application & System Architect and working on Salesforce Platform since 2010. He is Salesforce MVP since 2017 and have 17 Salesforce Certificates.

He is a active blogger and founder of Apex Hours.

Articles: 440


  1. Please suggest a way on code review parameter basis on architecture diagram.

    Related to Data preparation and 735% coverage check.

    What if developer put summary method to cover up 75% guide line.

Leave a Reply