Java Reference
In-Depth Information
4. At some point, everything breaks down again. Programmers undertake new projects with
an inherent need to create decorators, observers, and some factories thrown in as well. At
this point, you'll see the dreaded interface‐abstract‐concrete class combo showing up for
every concept that needs to be defined. It is a grandiose architecture, but somehow, the joy
is lost.
5. And so, at some point, programmers try hard not to over‐engineer everything. Yes, big soft-
ware architectures are impressive, but for simple projects, simplicity also brings elegance.
The main takeaway is that you should keep things as simple as possible. What is important to
remember is that you should always keep an eye out for things that can be improved as your projects
grow. Starting out small is awesome to keep things moving along, but when it's time to finally fix
that hard‐to‐maintain issue, it's nice to keep the things you've learned in this chapter in the back of
your mind.
helpful libraries
It's impossible to list all libraries here, so the most common ones are included here for your
reference. The main reason why we discuss these here—in a chapter on patterns and best prac-
tices—is because the Java ecosphere thrives mainly thanks to the great amount of excellent,
well‐known, and reliable libraries that have been built by the community throughout the years.
Therefore, the old advice to “buy the best, build the rest” seems like a fitting inspiration (especially
when “buy” means “get for free” in this context) for this closing best practice, which is to make use
of helpful libraries. You might even end up loving some of them so much that you'll include them by
default on the build paths of all your projects.
apache commons
The Commons is an Apache open-source project dedicated to building reusable Java components. In
short, you could describe this as the project that adds the missing batteries to Java.
In actuality, this project does not encompass one library, but is split into a series of packages. Not
all of them are as useful, but the following ones are worth checking out:
Apache Commons Collections: Provides a replacement for Java's collection types. It is more
efficient, more expandable, and easier to garbage collect.
Apache Commons CSV: Useful when dealing with CSV files.
Apache Commons Exec: Useful when you want to start and manage other programs from
Java.
Apache Commons IO: By far the most widely used commons library, mainly due to its
FileUtils utility class, which adds a lot of static utility functions to deal with common file
handling operations in a sensible manner. One downside is that, for compatibility reasons,
File objects are used everywhere, instead of the NIO Path .
Apache Commons Lang: Adds functionality to Java's language core. Useful additions include
a better Math class and better String operation methods.
 
Search WWH ::




Custom Search