Thursday, November 17, 2011

Java Date encapsulation

http://c2.com/cgi/wiki?JavaUtilDate
 
When we design systems, we need to decide what it is (out of all the many different things we could do with dates) that we actually want to do in each instance. Then we should encapsulate just that functionality in our own classes, delegating where appropriate to java.util.Date, java.util.Calendar and java.text.DataFormat?. Importantly, we must decide how we compare, add and subtract intervals, and how we will display each type of date.
 
See http://joda-time.sourceforge.net for alternative