Know the feeling when you’re just about to release code to the public’s eye, and all you need to do is write that pesky build file? Even as I write it I feel it’s an understatement: the task of creating an ant build file can take a few good days out of anyone’s life, and even with copying the last project’s build file and changing a few parameters you can’t really minimise it to less than half a day’s work.Â
Imagining a method which receives as a parameter a type Object instance and needs to perform some action according to its type is not difficult. In fact, there are several design patterns that, when used in combination, help solve just that. However, this post is about adding a new switch..case construct to prevent some boiler-plate caused by these patterns.
Continue reading »
Whenever a class in my model contains a collection which requires that particular care be taken with its items, there’s an internal debate regarding how to expose it to other classes. And with this, there are two major schools: one, the paranoia-based approach which doesn’t allow external code to touch the collection’s internal items and two, the trusting approach which just returns the collection for everyone to deal with.
Continue reading »
Liked Chaotic Java? It's free! But I also make some other things that aren't, which you might like. Like Firewall, a rule changing, turn based strategy game for iOS.