[threeten-dev] [threeten-develop] DateTime interface
Roger Riggs
Roger.Riggs at oracle.com
Thu Dec 13 08:11:48 PST 2012
Hi,
The API is described as the date-time API and as a whole it manipulates
dates, times and related values. The DateTime interface ties all of those
concepts and objects together.
The code snippet below is not representative of how DateTime is
likely to be used. We would not promote that form of usage because
the concrete class and its immutability and finality are lost.
The DateTime interface predominately appears as an argument in the
parameter list of methods as a way to pass any of the concrete types.
The context of that class and method define the expectations of the
parameter.
The current name is a good one for the purpose and better than the
suggested alternatives.
The ripple effects of changing names add a significant risk;
any change must bring a real and indisputable benefit.
Roger
On 12/13/2012 10:42 AM, Stephen Colebourne wrote:
> Looking at it again, the DateTime interface is not that well named.
>
> Each of the following are implementations of DateTime:
>
> DateTime a = LocalDateTime.now()
> DateTime b = ZoneDateTime.now()
> DateTime c = LocalDate.now();
> DateTime d = LocalTime.now();
> DateTime e = Instant.now();
> DateTime f = ZoneOffset.UTC;
>
> While LocalDateTime and Zone[d]DateTime make sense, the others make
> far less sense.
>
> Why does LocalDate implement DateTime when it has no time?
> Why does ZoneOffset implement DateTime when it has neither a date nor time?
>
> The purpose of the interface is to effectively represent common access
> to some part of the date/time domain.
>
> For a long time, the name was Calendrical, but that wasn't much liked.
> Some alternatives:
> - Calendrical
> - Calend
> - Moment
> - TimeAspect
> - Temporal
>
> Personally, I think "temporal" is pretty good. It means "of or
> relating to time".
>
> Other suggestions welcome, although change is not yet certain.
>
> Note that there are some other related interfaces:
> - DateTimeAccessor
> - DateTimeField
> - PeriodUnit
>
> Some or all of these might also make sense to consider.
>
> Stephen
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> threeten-develop mailing list
> threeten-develop at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/threeten-develop
--
Thanks, Roger
Oracle Java Platform Group
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to
developing practices and products that help protect the environment
More information about the threeten-dev
mailing list