|
Developing Good Project
|
Posted On :
Nov-23-2010
| seen (335) times |
Article Word Count :
451
|
|
Read this article if you have at least some experience as a Java programmer and knowledge of OOPs concepts. Try to follow these basic details while developing the project so that you can achieve good level of maintainability.
|
Read this article if you have at least some experience as a Java programmer and knowledge of OOPs concepts. Try to follow these basic details while developing the project so that you can achieve good level of maintainability.
(1) Hide Implementation details
As Java is an object oriented programming language, it provides encapsulation. Always hide the implementation details by utilizing the encapsulation. Encapsulation hides the internal state of the object and performs all the interactions through methods. So, the internal implementation details will be safe from outside hackers.
(2) Don’t do much subclassing
It is always better not to subclass more than two to three levels deep. Only create a subclass if it is strongly necessary for adding important specific functionality in a separate class.
(3) Use local variables when possible rather than instance variables
When applicable, it is always better to make use of variables that have small scope like local variables declared in blocks, methods or loops.
(4) Initialize local variables
Local variables have to be assigned a value before they are used because local variables are not initialized automatically like the instance or static variables.
(5) Utilize Overloading
If two or more methods are doing the same job but have to handle different method arguments, assign the same name to all those methods but with unique method arguments.
(6) Don’t use too much arguments in a method
If the method is taking too much arguments then think of creating its own class with all that stuff.
(7) Utilize Interfaces
If you want to protect your code by showing only the definition to outside world and hiding the implementation details, make use of interfaces
(8) Only create an object when it is really necessary
Avoid creating objects thinking that they may come to use later in the code as this may lead to lag in the performance and unnecessary confusions.
(9) Manage objects
Always watch the objects you have created. If they are no longer useful, set them to null for better memory management and avoid confusion.
(10) Don’t nest if or if else blocks heavily
Always better to design and follow simple logics rather than using deeply nested blocks. Consider writing separate methods for inserting those logics.
(11) Use meaningful names
Always use meaningful names for variables, methods, classes, interfaces and Exceptions.
(12) Declare a method as static only if necessary
Using non-static methods is always better than using static methods as the non-static methods contain the knowledge of the current object. But if you want to know some things which are not object specific, then make use of static methods.
(13) Getters and Setters
|
|
Article Source :
http://www.articleseen.com/Article_Developing Good Project_42778.aspx
|
Author Resource :
With this article you can know the principles to be followed for developing java project. If you have at least some experience as a java programmer and knowledge of OOPs concepts. Try to follow these basic details while developing the project so that you can achieve good level of maintainability.
|
Keywords :
good projects, Java programmer, OOPs concepts,
Category :
Computers
:
Computers
|
|
|
|