Writing code to follow best practices is at the heart of good coding practice. We have highlighted below a few of the things you would need to look out for when reviewing code.
-
DRY (Don’t Repeat Yourself) Code should be DRY. Just like earlier mentioned, you need to ask the question “Is there redundant or duplicate code?”. Ensure that unnecessary repetitions don’t exist within the code base.
-
Object Oriented Programming Follow SOLID principles for writing object oriented programs. At the very least, we should ensure that programs have high cohesion and loose coupling.
-
Documenting Code Code is expected to be thoroughly documented. Always use doc style comments if possible but also write code in a way that you may require little or no comments.
-
Separation of Concerns Technically, you could write an entire application code within a single file. But that would prove to be a nightmare to read and maintain. Ensure that your code is always broken into logical containers, properly arranged within folders. This makes it far easier to navigate through your codebase.
As a general rule of thumb, ensure the reviewee is writing the kind of code YOU can ship as your own.
(TODO: Language Specific best practices)