Java Magazine Edition about Libraries

By Guest Blogger Andrew Binstock 

In an age of frameworks, there still remains a supreme need for libraries, those useful collections of classes and methods that save us a huge amount of work. For all the words spilled on the reusability of object orientation (OO), it’s clear that code reuse has been consistently successful only at the library level. It’s hard to say whether that’s a failure of the promises of OO or whether those promises were unlikely to ever deliver the hoped-for reusability. 

In Stephen Colebourne’s article (page 28), he gives best practices for writing libraries of your own. Colebourne is the author of the celebrated Joda-Time library, which was the standard non-JDK time and date library prior to Java SE 8. In the article, he gives best practices for architecting the library and shares guidelines he has learned along the way that sometimes fly in the face of generally accepted programming precepts. Writing your own library? Then start here

We also examine three well-designed libraries that provide useful functionality but might not be widely known. The first of these is Project Lombok (page 10), which uses annotations to greatly reduce the writing of boilerplate code—leading to fewer keystrokes and much more readable code. Andrés Almiray’s article on the JDeferred library (page 16) is a deep dive into the concepts of futures and promises, which are techniques for defining, invoking, and getting results from asynchronous operations. The built-in Java classes for futures and promises work well but can be difficult to program. JDeferred removes the difficulty and, like Lombok, leads to considerably cleaner code. 

Finally, we revisit an article we ran a year ago on jsoup (page 22), which is one of the finest ways of handling HTML: parsing, scraping, manipulating, and even generating it. 

If libraries are not your favorite topic, we have you covered with a detailed discussion (page 34) of how to use streaming syntax rather than SQL when accessing databases. In addition, we offer our usual quiz (this time with the inclusion of questions from the entry-level exam), our calendar of events, and other goodness. (Note that our next issue will be a jumbo special issue on Java 9.) 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.