Improving Code Quality For Java Projects PDF
Improving Code Quality For Java Projects PDF
We’ve all seen the above image being mentioned in the context of code
quality. But what do we mean when we say that a particular piece of code
is good or bad?
The more of the above qualities that a code possesses, higher will be the
quality of the code. Based on Project/Client requirements some of the
above characteristics might not be required for the code.
Based on my experience, below are a few things that have been highly
effective in improving and maintaining high-quality code in my projects.
. . .
Code complexity
Below are some tools that can be integrated into your projects with very
little efforts:
Checkstyle
Checkstyle is a static code analysis tool used in software development for
checking if Java source code complies with coding rules. The checks
performed by Checkstyle are mainly limited to the presentation of the
code. These checks do not confirm the correctness or completeness of
the code.
Below are some of the checks that can be performed using checkstyle:
Line lengths
PMD
PMD (Programming Mistake Detector) is a static code analyzer that
reports on issues found within the application code.
PMD can help detect issues in the code that could cause issues when the
code is shipped to production.
. . .
Only unit tests should be considered when looking at the code coverage
metrics as unit tests are about testing whether the code does what the
developer intended it to do and those are the ones that are the fastest
ones in execution and deliver higher value.
Toxicity Chart
Toxicity Chart as the name suggests is a way of figuring out the toxicity of
the code. This chart represents the toxicity of each class in the codebase
based on a toxicity score that is calculated based on a set of parameters
like file length, method length, cyclomatic complexity, nested statements
and many more. This chart can be shown to non-technical people like
business people, managers to help them understand the quality of code.
. . .
Reference Code
The Github repository at the link below contains a sample project with all
of the above-mentioned tools setup. It is structured as easy to pick and
choose which tools you require to integrate into your projects.
https://github.com/singhalkul/java-quality-checks
. . .
While the tools mentioned above will help make sure that some of the
code quality aspects are present in the code, it is not the only way.
Following extreme programming practices like pair programming, test-
driven development, code reviews, continuous integration should be
followed by teams to make sure that all the characteristics of high quality
code are present in the codebase.
270 claps
WRIT T EN BY
inspiringbrilliance Follow
Here’s Yet Another List Hunting Good Bugs with Setting up a Python + Transfer le from FT P
of Exciting Projects to only <HT ML> Postgres environment server to A S3 bucket
Build Ak1T 4 for Data Science using python
Indrek Lasn in Better Victoria Perez Mola in T he Kiran Kumbhar in Better
Programming Startup Programming