Date and Time API: Round 3
...build upon the lessons learned from the first two APIs (Date and Calendar) in Java SE, providing a more advanced and comprehensive model for date and time manipulation.There are three areas identified that the new API will aim to improve:
- A data model for dates and times that provides much more than the existing Date and Calendar.
- Date and Time issues including formatting, parsing, serialization and persistence.
- Simple to use API.
For additional information check out the following links:
Two years
by
Roland Carlsson
90 classes - simple to use?
by
Thomas Mueller
How can you replace 2 classes with 90 classes? Who needs classes like 'Years', 'Weekyear', 'MilleniumOfEra'?
Please, please, please simplify!
Re: 90 classes - simple to use?
by
Jonathan Allen
Re: 90 classes - simple to use?
by
Jonathan Allen
For example:
Period p = periodBuilder().years(2).days(5).minutes(30).build();
Instead of something sane like a constructor, we have to deal with a completely separate object?
This is the kind of silliness that makes people think Java is bloated.
Re: 90 classes - simple to use?
by
Mileta Cekovic
In my opinion new Date and Time API does both. Note that date, time, period, interval etc. are valid and essential date/time manipulation constructs and are indeed needed, otherwise old Date and Calendar would be sufficient.
Re: 90 classes - simple to use?
by
Miguel Ping
Re: 90 classes - simple to use?
by
D Alexander
What's insane about that?
I'd much rather maintain:
Period p = periodBuilder().years(2).days(5).minutes(30).build();
than
Period p = new Period(2, 5, 30);
Re: 90 classes - simple to use?
by
Thomas Mueller
> number of classes is not the measure of simplicity
Somebody new to the API is lost.
> the nature of the problem is more complex
The nature of the problem is actually quite simple: You need a date (maybe a time and timestamp), an interval, a calendar, a timezone.
For example, why are "MilleniumOfEra", "SecondOfDay", "WeekOfWeekyear" (and so on) a class? They should be methods (a setter and a getter). Actually things like "Millenium", "DecadeOfCentury" are not required at all. For most people the concepts 'Durations', 'Periods', and 'Intervals' will be confusing. I don't think this distinctions is required. Also 'Partials' are not required.
Re: 90 classes - simple to use?
by
Dave Rooney
You sound like you have some good ideas. The Open Source mantra is, "if you don't like it, fix it!". So, if you haven't already, write the library yourself and make it available to the general public.
Dave Rooney
Mayford Technologies
Re: 90 classes - simple to use?
by
Thomas Mueller
Thanks! So you agree it's too complicated?
> Open Source
This is a JSR. Even if I write a better library, it will not be included in the next JDK. However, JSR 310 could be included in Java 7. I'm scared.
Re: 90 classes - simple to use?
by
Francois Ward
Re: 90 classes - simple to use?
by
Olivier Allouch
Period p = new Period({years: 2, days: 5, minutes: 30});
Sun, please, kill JavaFX and simplify Java.
Re: 90 classes - simple to use?
by
Rob Elliot
> This is a JSR.
So what? Same principle applies; this JSR is firmly community driven. The lead developer on this one is doing so in his own time at his own expense, having previously written a successful open source date time API (Joda Time) of his own.
It's been out there for two years, available for anyone to participate in. Still is. Quoting from jsr-310.dev.java.net/:
"The main activity of the JSR will be on the public mailing list. If you are interested in observing or contributing to the discussion of this JSR, please feel free to join. Anyone can sign up to the dev mailing list.
If you want to contribute suggestions, ideas or use cases on a one-off basis, the wiki may be for you. Especially feel free to add any requirements you have for the API to the requests page.
If you want to raise bugs or feature requests on the code then you must become a java.net project member. To do this please request the special jsr>jsr-310.Observer role using the web form."
Re: 90 classes - simple to use?
by
Stephen Cresswell
java.util.Date - love the smell of deprication in the morning
Re: 90 classes - simple to use?
by
Jonathan Allen
Educational Content
Writing Usable APIs in Practice
Giovanni Asproni May 19, 2013
Concurrency in Clojure
Stuart Halloway May 17, 2013




Hello stranger!
You need to Register an InfoQ account or Login to post comments. But there's so much more behind being registered.Get the most out of the InfoQ experience.
Tell us what you think