Code review checklist : Amit Chaudhary

Code review checklist
by: Amit Chaudhary
blow post content copied from  Apex Hours
click here to view original post

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?

  • Project Cost : 40%–80% of the lifetime cost of a piece of software goes to maintenance.
  • Maintenance : Hardly any software is maintained for its whole life by the original author.
  • 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
  • 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.
  • Consistency : Introduce consistency to coding practices across length and breadth of implementations.
  • Code-reusability : Introduce code-reusability to repeatable processes and procedures.
  • Significantly reduce development time and effort, improving productivity.
  • Minimize POF’s (point of failure) during implementations.

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

  • I am able to understand the code?
  • Is Class/Method is too big ?
  • DML/SOQL inside for loop
  • Code coverage is 75+
  • Code formatting & Naming Conventions
  • Is code following Standard/ Guidelines.

Expert Code Review

Let see what a expert code reviewer think about doing code review. Here is expert level code review checklist.

  • Is code is following Standard Guidelines
  • Is code following Defined Architecture?
  • Is the code meeting the Non Functional Requirement ?
    • Is the code Scalable to support huge number of users?
    • Is the Performance acceptance with hug data?
    • Is Security taken care?
    • Is the Code Maintainable easily?
  • Apex Best Practices : Prefer clicks over code where ever possible
    • Avoid Hardcoding IDs
    • Bulkify your Code
    • No DML/SOQL inside for Loop
    • Create one Trigger per object
    • 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.
    • Utilize Map for queries
    • Use of the Limits Apex Methods to Avoid Hitting Governor Limits
  • OOAD ( Object Oriented Analysis & Design)
    • Separation of Concerns
    • DRY Principle
    • 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”
    • Dependency Injection
  • Static Code Analysis : Use tool to avoid spending to much time on code review which tool can do.
  • Follow Integration Pattern & Best Practices

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

Further Learning

If you like this post please add comment. I would like to some more tips on this topics. FREE free to add some Tips and best practice in comment. I will try to add in post.

The post Code review checklist appeared first on Apex Hours.

April 10, 2021 at 03:24AM
Click here for more details...

The original post is available in Apex Hours by Amit Chaudhary
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.