Apr
11
2010
Why should you adopt Test Driven Development? The answer is actually more complex than many people think.
Of course we all want to have fully tested code to ensure that the code operates as expected. We also want to ensure that any new features do not break existing functionality (regressions), but what other reasons are there?
Continue reading
no comments | tags: Add new tag, JUnit, TDD, test driven, testability, unit testing | posted in Software Architecture, Software Development, Technology
Apr
10
2010
Web programmers know that they shouldn’t go writing JSPs with the Context Path hard coded in them.
If you do the following:
<a href="/MyApp/path/to/controller/home.htm> Home </a>
You’ll notice that as soon as you decide to deploy your web application using a different name than “MyApp” then none of your links will work anymore.
To avoid this you need to get the context path from the HttpRequest object as follows:
<a href="<%=request.getContextPath() %>/path/to/controller/home.htm>
Home
</a>
or by using a JSTL tag:
<a href="<c:url value="/path/to/controller/home.htm"/>"> Home </a>
What happens when you are rendering HTML in your Java code and you don’t have access to a HttpRequest object for whatever reason?
Continue reading
no comments | tags: Java, servlet, web | posted in Web Applications
Apr
10
2010

POWDER proves that graphics really isn’t everything when it comes to games. POWDER is a Roguelike game, which means that you kill monsters, gain levels, zap things with magical wands and generally get involved in all sorts of fantasy RPG shenanigans. Classic Roguelikes of the likes of Nethack and Angband are purely ASCII based and (in my opinion) aren’t very accessible. With POWDER the entire game can be played using the mouse, and the keyboard shortcuts can be picked up bit by bit once you’ve got into the game.
It has been designed with hand held consoles in mind, but can be downloaded and played on Windows and Linux alike from the author’s web page.
Behind a somewhat simplistic facade is a deep and complex game that will take you a very long time to master. Each time you play (and die) there is something new to be learned for the next time you delve into the dungeon. The first time I played the game indicated that I was hungry. I decided to eat a slug that I had just killed, only to be poisoned and die. Naturally I avoided doing that in subsequent attempts. There is even a tutorial to help you get started.
A wiki exists for impatient players who don’t want to find everything out for themselves. I still haven’t figured out how to stop myself from starving to death once I get a bit deeper into the dungeon.
Update: Two interesting things I also think are worth mentioning.
Roguelikes aren’t purely fantasy based. There are a great deal of science fiction based games, include a version of Doom implemented in ASCII.
Also, there is a yearly competition where programmers try to create a fully playable Roguelike in just 7 days. The short time encourages programmers to try out and explore new ideas and end up with a finished product at the end.
no comments | tags: rogue | posted in Gaming
Nov
17
2009
This is a photo I took in Bejing a few years ago and have been meaning to upload it for ages. The picture is of a couple of guys repairing a telephone line (or some sort of overhead cable). The work was undertaken in the face of oncoming traffic.

Street work in Bejing
no comments | tags: dangerous | posted in Fun, Travel
Nov
16
2009

A couple of months ago I finished the first version of JTestConnect. It is a tool for supporting development teams with their unit test strategies.
You can annotate your interfaces/classes with annotations describing how the object should be tested. The tool then sits in the build process and can interrupt a build if test classes/methods are missing.
Ideally, this would be added to a Continuous Integration build system to enforce test coverage of important classes.
A more detailed description of what it does can be found on the project home page.
no comments | tags: Java, TDD, test driven, unit testing | posted in Software Architecture, Technology
Nov
16
2009
How can you detect if your browser supports HTML5 features in javascript? Here’s how:
function isHTML5CanvasSupported() {
return (typeof HTMLCanvasElement != 'undefined');
}
function isHTML5VideoSupported() {
return (typeof HTMLVideoElement != 'undefined');
}
function isHTMLClientSideDBSupported() {
return (window.openDatabase);
}
Have fun!
no comments | tags: html5, javascript | posted in Technology, Uncategorized, Web Applications
Mar
9
2009

Near to Tikal in Northern Guatemala
no comments | posted in Fun, Travel
Mar
6
2009
There are two competing philosophies with regard to unit testing strategies; state based testing and behavior based testing. In state based testing we configure a starting state, execute a test method, and then examine the resultant state/returned result. In behavior driven testing we ensure that our test object collaborates with its dependencies in an expected way.
Continue reading
2 comments | tags: EasyMock, Java, JUnit, Testing, Web Applications | posted in Software Architecture, Technology, Uncategorized, Web Applications
Feb
5
2009

Random Numbers
2 comments | tags: cats, GIMP, pixel art, random numbers | posted in Art, Fun, Technology