FIRST Principles for Writing Good Unit Tests
In any application, which solves real-world problems, having problems in its unit tests – is the least desirable thing. Good written tests are assets while badly written tests are burden to your...
View ArticleJava Web Application Performance Improvement
Web application’s performance is very critical for the success of the project, in any company and with any client. You should have a good thought process about possible bottlenecks and their solutions....
View ArticleUnit Testing DAO Layer
If you are working in a project built on Spring, hibernate or JPA, and you want to unit test it’s data access layer (DAO) then information given in this tutorial may help you. As we are going to test...
View ArticleUnit Testing Best Practices
It is overwhelmingly easy to write bad unit tests that add very little value to a project while astronomically inflating the cost of code changes. This post will go through the JUnit best practices we...
View ArticleJava Custom Exceptions and Best Practices
We have been using handling java custom exceptions in our code for almost every industry standard application. Usual approach is to create some custom exception classes extending the base The post Java...
View ArticleJava Naming Conventions
Java naming conventions are sort of guidelines which application programmers are expected to follow to produce a consistent and readable code throughout the application. If teams do not not follow...
View ArticleJava Override toString() with ToStringBuilder
ToStringBuilder is a utility class provided by apache commons lang library. ToStringBuilder is a utility class provided by apache commons lang library. It provides a consistent and better control over...
View ArticleJava ConcurrentHashMap Best Practices
The ConcurrentHashMap is very similar to the HashMap class, except that ConcurrentHashMap offers internally maintained concurrency. It means you do not need to have synchronized blocks when accessing...
View ArticleRESTEasy – Share Context Data with ResteasyProviderFactory
Many times we get into situation where we have to pass data from-to multiple layers in our application. An example can be application using interceptors. Suppose we have two interceptors in our...
View ArticleJava NullPointerException – How to effectively handle null pointer in Java
Java NullPointerException is an unchecked exception and extends RuntimeException. NullPointerException doesn’t force us to use catch block to handle it. This exception is very much like a nightmare for...
View ArticleTop 20 Java Exception Handling Best Practices
Learn the top Java exception handling best practices to follow in any Java application. These best practices are application for kind of java applications. The post Top 20 Java Exception Handling Best...
View ArticleUse Array instead of Vector.elementAt() for Better Performance
Vector is a another legacy implementation of List interface provided with java bundle. It is almost similar to ArrayList expect it is synchronized also. It has its own advantages as well as...
View ArticleAlways Use length() Instead of equals() to Check Empty String
In your day-to-day programming activities, you must be coming across multiple situation where you need to check if a string is empty. There are various ways to do this and some use string1.equals(“”)....
View ArticlePerformance Comparison – Different For Loops in Java
For loop is very common control flow statement in programming languages such as java. I am not going to describe the basics of “for loop” as it is beyond the scope of this article and most of us are...
View ArticleJava Serialization – Dos and don’ts for correct serialization
Java Serialization - Dos and don'ts for correct serialization and deserialization. Learn to use serialVersionUID, readObject and writeObject with example. The post Java Serialization – Dos and don’ts...
View ArticleJava clone – deep and shallow copy – copy constructors
A clone is an exact copy of the original. The java clone() method provides this functionality. Learn to create shallow copy, deep copy and using copy constructors in Java. The post Java clone – deep...
View ArticleCreate eclipse templates for faster java coding
Most of us who have worked on eclipse IDE for writing code, must have use shortcuts like main or sysout and then hit CTRL+SPACE, it converts the shortcut into public static void main(String[] args){…}...
View Article13 best practices for writing spring configuration files
Spring is a powerful Java application framework, used in a wide range of configuration options. Its best feature if that it provides enterprise services to Plain Old Java Objects (POJOs) called beans....
View ArticleDo not specify version numbers in Spring schema references
If you have worked on Spring projects, then you must have seen spring configuration files where in header you specify the schema references for various spring modules. In schema references, we mention...
View ArticleBest practices to improve JDBC performance
Java database connectivity (JDBC) is the JavaSoft specification of a standard application programming interface (API) that allows Java programs to access database management systems. The JDBC API...
View Article