I've obviously not posted for quite some time and here is the reason why.....
It's been a long time coming, but I'm very happy to announce that Ben Evans and I have been contracted to write "The Well Grounded Java 7 Developer" for Manning publications. We've been spending the last month frantically getting the first few chapters out and a whole host of other book related activities, but now that I'm in full chapter writing mode I'll be adding regular posts to this blog.
A majority of my future posts will focus on interesting areas in this book and firstly I'd like to show a reworked extract from the new Date and Time API section.
Modeling Date and Time
The new API models time as a sequence of consecutive instants separated by fixed durations[1]. Java 7 maps these concepts directly on to classes, here's a more detailed explanation:
- The javax.time.Instant class represents a specific point on a discrete time-line e.g. January 23rd, 1996 at 09:00:00,0 UTC, the day that Java 1.0 was released.
- The javax.time.Duration class represents a section of elapsed time in nanoseconds, e.g. The 400 nanoseconds it takes for a PIC12C672-04 Microchip to execute an instruction set.
So as you can imagine, any point of time can be modeled by simply applying a Duration (positive or negative) to a starting Instant.
...
...
Calendering
With regards to calendaring, the main Calendar is ISOChronology, but other calendars such as CopticChronology and ThaiBuddhistChronology are supported. The Chronology interface can be extended from to provide other implementations.
...
...
Timezone support
Timezone support is also provided via three core classes:
- LocalDateTime – Represents date/time without an offset or a time zone.
- OffsetDateTime - Represents date/time with an offset but not time zone.
- ZonedDateTime - Represents date/time with an offset and a time zone.
...
...
[1] This phrase is almost 100% uplifted from an excellent early primer article by Jesse Farnham, see http://today.java.net/pub/a/today/2008/09/18/jsr-310-new-java-date-time-api.html for details
Sign me up. If I can make sense of it, it's sure ot be a winner!
ReplyDeleteHi Chris,
ReplyDeleteI've dropped you an email, welcome aboard!
Hi Martijn,
ReplyDeleteI am interested too. Let me know if you are still looking for one.
-Arul
Hi Arul,
ReplyDeleteI see you've joined up to out mailing list - we'll be letting people know when they can start reviewing once the book is in the MEAP stage.
Cheers,
Martijn
Congrats on the book! And I'm so pleased that you're adapting my title. I'd always hoped someone would -- it could make a great basis for a series, if I say so myself.
ReplyDeleteI was inspired directly by "The Well-Tempered Clavier". I'm not sure how I made the leap to "Well-Grounded Rubyist", but Bach was definitely the starting point. I was worried at first that Manning wouldn't accept the title, since it didn't match any of their existing series and had a pretty strongly "branded" sound of its own. To my delight they did like it, and I'm glad to see it have new life.
Best wishes for the project!
David Black
Hi David,
ReplyDeleteThanks for the kind words! Yes Manning suggested using that title (it's changed slightly now) as it fell in line with your "The Well-Grounded Rubyist". Hopefully both books will do well and we can keep the series going . See you in the MEAP no doubt!
Cheers,
Martijn