Tuesday, July 26, 2011

Top TEN Tips for code reusability, maintainability, and flexibility

Top TEN Tips for code reusability, maintainability, and flexibility

Writing a product is not an overnight job. It is the practice of implementing combination of the identified requirements in field and interest of field in future. Successfull product needs several processes, which are enforced from the one liner requirement to the completion of the product. The process are evolved and fine-tuned to improvise the quality and user experience. Product developers has to focus on the best practices in coding which avoid surprises in customer environment.

Development time – An individual has to love, to write more code. Optimization (Code coverage) time - An individual has to hate the code written already.

Reusability, Maintainability, and Flexibility are the major key factors to keep the product stable and long-lived.

  1. If happened to type same set of lines again , please move them to new method.

  2. If same set of lines exist already in a method, wanted to reuse it, please move that piece of code to new method. And , existing piece of lines has to be removed and new method has to be get called.

  3. If found new method may be used by other classes, and found as utility API, then it has to be moved to necessary class with 'public static' access.

  4. If Double quoted string needs to be used in the code and found it may be required to capture in other classes too, then create a class field(constant)with 'public static final' access. Where field name keeping in UPPERCASE would be good.

  5. Writing method with approx 1000 lines with hundreds of local variable , will perform slower than splitting into 10 to 15 methods with hundreds of local variable. In addition, it helps to improve the code readability and reusability. Methods needs to be very precise to do particular task as per name of the method. For instance, method name is purge(), then collecting or filtering purgeable data logic has to be placed in other methods. In this method, only purge logic such as API calls to purge or transaction API calls can be written.

  6. JUNIT testcases has to be added to test negative usecase where incorrect values for the argument get passed, and positive test has to be done by passing possible values. This helps to cover and confirm , possible values for the arguments. And, regression bugs will be avoided more than 99 percentage.

  7. In J2EE application, maintaining the actual business implementation away from the EJB methods would be good. EJB methods has to act like deligate method and calls the method which has actual implementation in other class. This business implementation may be reused in WS, JMS and/or other J2EE technology.

  8. In an application, a JAVA Class has to be introduced to keep only rt.jar based utilities ( public APIs). These APIs can be used by application , or developer for testing dirctly without associating any other jars from the dependency components.

  9. Utility methods needs to have JAVA Doc comments with @author . Whenever the method gets modified by other developer, it is easy to cross check with the developer.

  10. Dependency component's jar/classes has to be accessed through a single class(Wrapper around the component). If depedency component usage is more then a package can be introduced to deal with that component.

10 comments:

divyapriya said...

Great information you have been shared and it will be useful to everyone.
Spoken English Classes in Chennai
Best Spoken English Classes in Chennai
German Classes in Chennai
TOEFL Coaching in Chennai
IELTS Coaching in Chennai
spanish language in chennai
Spoken English Classes in OMR
Spoken English Classes in Porur

sheela rajesh said...

Thanks for your interesting ideas.the information's in this blog is very much useful
for me to improve my knowledge.
Python Training in Chennai
Python course in Chennai
Big data training in chennai
JAVA Training in Chennai
Selenium Training in Chennai
Python Training in Chennai
Python Course in Chennai

sultana said...

Thanks for sharing this valuable information to our vision. You have posted a worthy blog keep sharing.
Tally Course in Chennai
Tally Classes in Chennai
ui design course in chennai
CCNA Training in Chennai
ReactJS Training in Chennai
microsoft dynamics crm training in chennai
Tally Training in Chennai

velraj said...

This information is quite useful, I truly enjoyed. Thanks for this blog.
Appium Training in Chennai
Mobile Appium course in Chennai
Appium Training in T Nagar
JMeter Training in Chennai
learn JMeter
core java training in chennai
C C++ Training in Chennai
javascript training in chennai

kiruthika said...

Such an excellent and interesting blog, do post like this more with more information, this was very useful, Thank you.
best aviation academy in Chennai
air hostess training academy in Chennai
diploma in airport management in Chennai
Ground staff training in Chennai
Aviation Academy in Chennai
air hostess training in Chennai
airport management courses in Chennai
ground staff training in Chennai

Kerrthika K said...

It's a magnificent blog!thanks for sharing this information
film making courses in chennai
film courses in chennai
best film school in chennai
acting course in chennai
film editing course fees in chennai
film institute in chennai
part time film direction course in chennai

Anjali Siva said...

Such an amazing blog with new updates. I love to learn more about this topic. Waiting for more like this.
Microsoft Dynamics Training in Chennai
Microsoft Dynamics crm Training institutes in Chennai
Salesforce Training in Chennai
AngularJS Training in Chennai
Microsoft Dynamics crm Training in Velachery
Microsoft Dynamics crm Training in T Nagar
Microsoft Dynamics crm Training in OMR

Gabe Co Hadwin said...

Great Article. Thank you for sharing! Really an awesome post for every one.

IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Project Domains for IT It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

JavaScript Training in Chennai

JavaScript Training in Chennai


Chris Hemsworth said...

I have been reading for the past two days about your blogs and topics, still on fetching! Wondering about your words on each line was massively effective. Techno-based information has been fetched in each of your topics. Sure it will enhance and fill the queries of the public needs. Feeling so glad about your article. Thanks…!
best software testing training in chennai
best software testing training institute in chennai with placement
software testing training
courses

software testing training and placement
software testing training online
software testing class
software testing classes in chennai
best software testing courses in chennai
automation testing courses in chennai

Unknown said...

I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!
Web Designing Training Institute in Chennai | web design training class in chennai | web designing course in chennai with placement | Web Designing and Development Course in Chennai | Web Designer Training Course in Chennai
Mobile Application Development Courses in chennai
Data Science Training in Chennai | Data Science courses in Chennai
Professional packers and movers in chennai | PDY Packers | Household Goods Shifting
Web Designing Training Institute in Chennai | Web Designing courses in Chennai
Google ads services | Google Ads Management agency
Web Designing Course in Chennai | Web Designing Training in Chennai

Post a Comment

Recent Posts

Unix Commands | List all My Posts

Texts

This blog intended to share the knowledge and contribute to JAVA Community such a way that by providing samples and pointing right documents/webpages. We try to give our knowledege level best and no guarantee can be claimed on truth. Copyright and Terms of Policy refer blogspot.com