How to eliminate a parameter boom

Hello folks. Today I want to write about a little trick I learned. If you are working with legacy code and you don’t have the chance to eliminate core design problems, you can use this little pattern to help you out. Problem Problem is that you have a class that has a gazillion collaborators and at some point in time one of the clever devs thought it would be a cool idea to do dependancy injection via the constructor....

October 9, 2012 · 3 min · hannibal

TDD and Game of Life

So today at 8-12PM I had a great session with two friends of mine. It was awesome. Like a mini code retreat. We set down in a musky bar, drank wine and beer and cider, and decided to practice some TDD with the well known problem of Conway’s Game of Life. This challenge is really interesting. I never done it before, ever. So it was a really good practice for me....

July 12, 2012 · 3 min · hannibal

Solution to Wrap Kata

My solution to the String Wrap Kata. The goal is to have it wrap a text on a given column width. It is not the best solution but this is my first try. I did it with TDD so there were tests first, which I’m not going to copy in.. public class WrapKata { public String wrap(String input, int columnSize) { if (input.length() <= columnSize) return input; else { return wrapLines(input, columnSize); } } private String wrapLines(String input, int columnSize) { int breakPoint = getBreakPoint(input, columnSize); String head = createHead(input, breakPoint); String tail = createTail(input, breakPoint); return head += "\n" + wrap(tail, columnSize); } private String createTail(String input, int breakPoint) { return input....

June 26, 2012 · 1 min · hannibal

JMS Connection setup and Framework

Hello chumps. Today I want to write about jms connection testing with a small framework. I wrote a small thing using a factory object model. It’s a lead, a proof of concept. You can use this to go onward. First, let’s begin with the JMS connection it self. JMS Connection First rule of thumb is: “Don’t wait for a response when dealing with JMS queues.” How so? Because, a JMS queue is asynchronous so you wont get back anything....

March 4, 2012 · 5 min · hannibal

Configuration

When I see something like this: public class Config { public static final string DATABASELINK = "linkhere"; . . . } It sends a small, but chilling shiver down my spine. Just. don’t. There are a lot of possibilities to use configuration in Java. Java property files. Xml. Xml serialization. CSV file. Whatever suits you best, but this? DON’T!

February 27, 2012 · 1 min · hannibal