Hi Fork,
From the title of this blog, you get an idea on which topic we have a
discussion today.
Agenda
To achieve clean code Practices in java.
Naming Convention :
·
This is
the main and very simple thing which makeover code clean and easy to maintain
in the future.
·
So while
creating any variable, method, and classes in java we should always give some
meaningful name to that field so that while reading we should get some idea
what that field do.
·
Because
of which it would be helpful in the future to understand that module by yourself as
well as your team member.
Remove Unused Resources :
·
While creating any Class Object or any variable
or after completing your model we should always check if there is any unused object is present or not.
·
And also avoid using un-necessary object
reference in class.
·
This will help in reducing unnecessary space
taken by the object in heap memory and improve your application performance.
Plan your Module First :
·
When starting with any new module always understand
the module and create the below things.
o
Module flow document.
o
Module technical flow.
o
Database diagram
· Because while coding you not should think about module flow.
·
And it will help you as a blueprint of your
module.
·
Always Plan this properly because it is hard to
do changes after going to production.
· And there would be fewer changes in your module after production.
One Method One Functionality :
l One method can only perform only one function.
l A normal method should have less lines of code, if the code length increases just refactor it into a new method.
l We should always write a method which should be easy to understand.