Skip to content

Monthly Archives: February 2011

Interface and Class Naming Anti-Patterns – Java Naming Convention Tautologies

28-Feb-11

Name your Interface what it is If your interface is a Truck, call it Truck. Not ITruck because it isn’t an ITruck it is a Truck. An Interface in Java is a Type. Then you have implementations of DumpTruck, TransferTruck, WreckerTruck, CementTruck, etc. When you are using the Interface Truck in place of a sub-class [...]

JSAP Command Line Application Maven Archetype

28-Feb-11

I have created my first Maven 2 / 3 Archetype for generating command line applications that are powered by Java Simple Argument Parser ( JSAP ). Its source code lives on GitHub. I am working on getting it posted to Sonatype and synced to Central Repository.

A Generic Object Oriented replacement for large Switch / Case and If / Else statements in Java

22-Feb-11

I saw this post on StackOverflow and thought I would whip up a quick Object Oriented solution using Generics using the Chain of Responsibility Pattern. This was a quick exercise to see how it might look. There are many other ways that this could be implemented, like using Dependency Injection to supply the implementations of [...]

Reading data from a file on the classpath in Java

22-Feb-11

Sometimes you want to load data at runtime from inside a .jar file or .war file to populate at List or Map or something. Here is how to do that easily. Just make sure that your data file is in the same package along side the Class that is loading it, or refer to it [...]

Working Maven 3 Google App Engine Plugin with GWT support.

06-Feb-11

I spent a great deal of time getting this to work. I could not find a single source of information on what all the needed dependencies and repositories were, so there was a lot of trial and error involved. This first version is configured for GAE 1.4.0 and GWT 2.1.1, the latest versions at the [...]