Writing a Huffman Encoder with Java 8 and Dagger 2

Last year I wrote a Huffman Encoder to try out Dagger 2, and to experiment with Java 8, as we’d just started using it at work.

As a dependency injection tool, the advantage of Dagger is that it generates dependencies at compile time, meaning it doesn’t require reflection and errors should be easier to spot up-front.

In practice, I had a hard time getting it to work until I found this great post on using annotation processors in eclipse. This makes sure eclipse does all of the annotation processing that Dagger requires at compile time, though I found I had to manually build the project to get this to work (rather than relying on save-and-build).

There aren’t many component parts to the program, so Dagger doesn’t have to do much. The project is possibly most useful as a basic skeleton showing Dagger 2 working with maven and JUnit tests.