One of the things that has struck me whilst learning J2EE is the fact that there's a symbiotic relationship between J2EE and the world of open-source software. There's a bewildering choice of open-source software available to the enterprise Java developer, encompassing everything from application servers to string libraries and anything you can think of in-between.
It's quickly become clear to me that there are two hard and fast rules to follow on any J2EE project:
- Identify what open-source projects are out there that can help you.
- Decide which ones are appropriate for use on your project.
As an example, on my current project we have a—by no means unusual—requirement to display potentially large amounts of tabular data, so we needed some way to provide paging of the list. We were about to design and implement our own solution, when I remembered reading about a JSP tag library on TheServerSide.com. A Google search later and I'd located the Display Tag library which does everything we need and a lot more besides. It would have taken us weeks to produce a fraction of the functionality ourselves.
I know this will be old news to some of my readers but it really is a fantastic component. Creating a four column, pageable list, where the first two columns can be clicked to sort them is no more complicated than these six lines of code:
<display:table name="somebean" sort="list" pagesize="8"> <display:column property="col1" title="Column 1" sortable="true"/> <display:column property="col2" title="Column 2" sortable="true"/> <display:column property="col3" title="Column 3"/> <display:column property="col4" title="Column 4"/> </display:table>
—Pretty neat, huh? Like all great components, virtually everything is fully configurable so it can be tailored to meet the exact requirements. If not, then you can always download the source. Go and play with the examples on the website if you're still not convinced.
One of the things I used to love when I was a Delphi developer was the large selection of open-source (or free closed-source), components. There were some real gems hidden amongst the endless chaff of clock components and rotated labels.
I remember when IE 3.0 first came out sporting its “revolutionary” flat look toolbar buttons. Shortly afterwards a friend came across a TExplorerButton component on one of the main Delphi sites and suddenly, with a few mouse clicks our applications could look like that too! Gimmicky perhaps but that sort of instant gratification was exciting to me in those days as a rookie programmer. I also think it was a powerful illustration of the power of OOP and a testiment to the great design of Borland's VCL framework. I get a real kick out of using a well designed, developed and documented component and Display Tag is all of those things.