Saturday, December 13, 2008

Java Application Design and Performance Tips



Java Application Design Tips

Developing jav applications requires you to keep certain strategies in mind during the design phase. It is best to strategically design an application before you begin coding. Correcting the code because you failed to consider all of the "gotchas" before developing the application can be a painful process for Java Application Design.

Here are some design strategies to consider for Java Application Design:

  • Keep it simple. Remove unnecessary features, possibly making those features a separate, secondary application. (Java Application Design)

  • Smaller is better. This consideration should be a "no brainer" for all developers. Smaller applications use less memory.(Java Application Design)

  • Minimize memory usage. To minimize the amount of memory used at run time, , do not depend on the garbage collector. You should manage the memory efficiently yourself by setting object references to null when you are finished with them. Another way to reduce run-time memory is to use lazy instantiation, only allocating objects on an as-needed basis. Other ways of reducing overall and peak memory release resources quickly, reuse objects, and avoid exceptions. (Java Application Design)

Java Application Performance Tips


Code for performance. Here are some ways to code with the aim to achieve the best Java Application performance:

  • Use local variables. It is quicker to access local variables than to access class members.

  • Avoid string concatenation. String concatenation decreases performance and can increase the application's peak memory usage.

  • Use threads and avoid synchronization. Any operation that takes more than 1/10 of a second to run requires a separate thread. Avoiding synchronization can increase performance as well.

  • Separate the model using the model-view-controller (MVC). MVC separates the logic from the code that controls the presentation.

1 comment:

Unknown said...

Great Tip , need some more details