DEV Community

Ilo Calistus
Ilo Calistus

Posted on

Some important points to watch out before you commit your code

Before you commit your code to avoid too much back and forth with the team lead, CTO or whoever is in charge of code review, ensure the following are points are in place :

  1. Code Style: Every organisation has a coding convention which they follow. It is good you figure this out even before you start coding.

  2. Amount of duplicated code: Always apply the DRY principle(Don’t Repeat Yourself)

  3. Cyclomatic complexity: This is the count of the number of decisions in your code. The higher the count, the more complex your code. Checking this early will help reduce code complexity and also determine the number of test cases required.

  4. Number of warnings: Whenever you see a warning by your IDE, it’s an indication that there is something you are not doing right. Though these things are usually safe to ignore but if you do so then over time they’ll multiply until that day comes when there are so many that you miss the one warning that really matters because it’s hidden your verbose logcat.

  5. Test Coverage: Your test should cover at least 80% of your codebase; if not all.

  6. Afferent and efferent coupling(package’s responsibility and package’s dependence on externalities respectively): Afferent coupling(Ca) is the number of classes from other packages which depend on a some classes in a particular package. Preferred values for the metric Ca are in the range of 0 to 500. Efferent coupling (Ce) is the number classes in a given package which depend on the classes in other package. The preferred value for the metric Ce is 0–20.

Top comments (0)