A big part of developer community has been complaining about Date and Calender classes. Reasons were many such as hard to understand, hard to use and not flexible. Date class has even become obsolete and java docs suggest to use Calender class instead of Date class. And on top of all, Date comparison is buggy [...]
A big part of developer community has been complaining about Date and Calender classes. Reasons were many such as hard to understand, hard to use and not flexible. Date class has even become obsolete and java docs suggest to use Calender class instead of Date class. And on top of all, Date comparison is buggy [...]
In spring framework, setting bean dependencies in configuration files is a good practice to follow, but the spring container is also able to autowire relationships between collaborating beans. This means that it is possible to automatically let Spring resolve collaborators (other beans) for your bean by inspecting the contents of the BeanFactory. Autowiring is specified [...]
This post is another addition in best practices series available in this blog. In this post, I am covering some well-known and some little known practices which you must consider while handling exceptions in your next java programming assignment. Follow this link to read more about exception handling in java. Sections in this post Type [...]
In software engineering, inversion of control (IoC) is a programming technique in which object coupling is bound at run time by an assembler object and is typically not known at compile time using static analysis. Sections in this post: IoC introduction Differentiating with dependency injection Various ways to implement IoC IoC in spring framework Ways [...]
You have learned that how to write the RESTful web services and also how to write Spring 3 web application. Now, its time to combine them so that your spring web application shall work like RESTful webservices also. Download source code For writing this application, I am modifying the source code written in previous post. [...]
Representational State Transfer (REST) is a design idiom that employs the web’s stateless client-server architecture to represent REST webservices as resources identified by URL. REST-style architectures consist of clients and servers. Clients initiate requests to servers; servers process requests and return appropriate responses. Requests and responses are built around the transfer of “representations” of “resources”. [...]
With release of java 7, oracle has done some good changes in exception handling mechanism also. Primarily these are improved catch block and redundant throws clause. Lets see how they got changed. 1) Improved catch block In this feature, now you can catch multiple exceptions in single catch block. Before java 7, you was restricted [...]
We all know what toString() method does. It returns a string representation of the object. This representation has been made informative for most of the java classes provided in JDK bundle. But still, arrays are one of such exceptions toString() method does not provide any useful information. In this post, we will learn about JDK’s [...]
We all know what Serializable interface guarantees i.e. ability to serialize the classes. This interface recommends you to use serialVersioUID also. Now, even if you use both in your classes, do know what can break your design even now?? Lets identify the future changes in your class which will be compatible and others which will [...]
Before writing this post, I am assuming that you know the basics of junit. If you do not have the basic knowledge, first read this link. Further, in this post, I will write the best practices you must consider before writing your test cases. “It’s overwhelmingly easy to write bad unit tests that add very [...]
Singleton pattern is a design solution where an application wants to have one and only one instance of any class, in all possible scenarios without any exceptional condition. It has been debated long enough in java community regarding possible approaches to make any class singleton. Still, you will find people not satisfied with any solution [...]
So far in this blog, we have been learning about building RESTful webservices which are server side components. In this post, we will learn to build a RESTful client for consuming the webservices written in previous posts. I will be re-using the code base written for RESTEasy + JAXB xml example. The APIs which I [...]
I hope, you will enjoy reading this blog as much as i enjoyed while writing it !!