Java Tips And Tricks Hi
Tips to make your program better
1. Don't make any class file larger than 1000 lines
2. Avoid Using Global Static function, if not possible then put that all function in a separate class.
3. Before starting the project Check out the proper decomposition of classes, interface and function. Practice of making structure then start coding.
e.g All Nouns is the probable candidate for classes and All Verbs are probable candidate for functions. User Interface wherever possible.
4. Always try to features given by java, don't try to write your own code if java provide such thing like StringBuffer, HashMap, ArrayList etc.
5. Always use the System properties handled by java for example. Don't use "\n" u can use
System.getProperty("line.separator");
6. Properly handle exception and their preferred treatment and if possible create a separate Exception Handling class where After Error message that thrown exception will be caught.
7. Avoid use of public data types for any class.
Keep sharing and reading
Thanks |