Archive for April, 2010

Apr
11

Goals of Test Driven Development

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?

(more…)

Apr
10

Getting The Context Path (Without a HttpRequest)

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?

(more…)

Apr
10

POWDER Roguelike Game

POWDER

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 (Game Boy Advanced, and now available on the iPhone), 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.  Roguelikes traditionally kill the player often and designed to be played repeatedly rather than just once or twice.  There is a tutorial however to help you get started (and to stop you from dying within the first two minutes).

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.