The Ceylon language takes a different approach to reading and writing files than Java. Consider the following methods in Java:
Java
How to Spoof Empty Collection injection in Spring
When we write libraries or frameworks, we sometimes have a class Foo
whose constructor takes a Collection
of Bar
s, where the Bar
s will be supplied by dependents.
Java’s Dependency (Mis)Management: How Maven and Gradle Cope
Dependency management is a hard problem, and Java doesn’t make our lives any easier. Popular build tools like Maven and Gradle do what they can, but their default behavior doesn’t always alert us to potential problems. While both tools can fail when there are dependency conflicts, they’re not enabled by default. Below we will walk through the evolution of a set of modules; how they can go from having no version conflicts, to having runtime failures that should be build time failures. We’ll examine why this happens, and what tools Maven and Gradle have to help guard against it.
Should methods return null or throw an exception?
As API authors, one thing we have to think about is, what happens when a method cannot fulfill its contract? Should it return null
or throw and exception? Sometimes we write both the API and its consumer. Our job—especially if your API will be used by developers that aren’t us—is to make that API as easy to use and understand as possible. While you might have heard the phrase, “use exceptions only for exceptional conditions”1, if done correctly, throwing and catching exceptions can ensure a level of correctness in our programs.
Javadocs Made Easier Using IntelliJ’s Live Templates
Writing Javadocs can be tedious. To make it easier, I use IntelliJ’s Live Templates. These are the Live Templates I use the most: