Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>EDIT: Now that Java 8 has been released, if you can use that, do so! <code>java.time</code> is even cleaner than Joda Time, in my view. However, if you're stuck pre-Java-8, read on...</p> <p>Max asked for the pros and cons of using Joda...</p> <p>Pros:</p> <ul> <li>It works, very well. I strongly suspect there are far fewer bugs in Joda than the standard Java libraries. Some of the bugs in the Java libraries are really hard (if not impossible) to fix due to the design.</li> <li>It's designed to encourage you to think about date/time handling in the right way - separating the concept of a "local time" (e.g "wake me at 7am wherever I am") and an instant in time ("I'm calling James at 3pm PST; it may not be 3pm where he is, but it's the same instant")</li> <li>I believe it makes it easier to update the timezone database, which <em>does</em> change relatively frequently</li> <li>It has a good immutability story, which makes life a <em>lot</em> easier IME.</li> <li>Leading on from immutability, all the formatters are thread-safe, which is great because you almost <em>always</em> want to reuse a single formatter through the application</li> <li>You'll have a head-start on learning <code>java.time</code> in Java 8, as they're at least somewhat similar</li> </ul> <p>Cons:</p> <ul> <li>It's another API to learn (although the docs are pretty good)</li> <li>It's another library to build against and deploy</li> <li>When you use Java 8, there's still some work to migrate your skills</li> <li>I've failed to use the <code>DateTimeZoneBuilder</code> effectively in the past. This is a <em>very</em> rare use case though.</li> </ul> <p>To respond to the oxbow_lakes' idea of effectively building your own small API, here are my views of why this is a bad idea:</p> <ul> <li>It's work. Why do work when it's already been done for you?</li> <li>A newcomer to your team is much more likely to be familiar with Joda than with your homegrown API</li> <li>You're likely to get it wrong for anything beyond the simplest uses... and even if you initially <em>think</em> you only need simple functionality, these things have a habit of growing more complicated, one tiny bit at a time. Date and time manipulation is <em>hard</em> to do properly. Furthermore, the built-in Java APIs are hard to <em>use</em> properly - just look at the rules for how the calendar API's date/time arithmetic works. Building anything on top of these is a bad idea rather than using a well-designed library to start with.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload