Developer's Diary
Software development, with Terry Ebdon
|
There was a bug in my dayNumberSuffix
method; see if you can spot it:
Today's page template had a header claiming the date was "30Huh? June". That's not right! So there are two bugs:
You might find it a bit odd that I'm using Ant to throw the exception. Currently the project logs everything via ant.echo()
and ant.fail()
. That's because I haven't, yet, incorporated a logging framework. The nice thing with Ant is that I can wire it up to my app's logger, using a listener. So if I add, say, Log4J I don't need to re-write all the existing message code. Plus my log file will then include all the messages that ant itself logs, correctly interleaved and formatted to my standard.
It's time to get a grip on i18n before the project gets too big. This is usually something that, like logging, I'd deal with up front. But this project started as a simple build script, for personal use. Now that it's started to grow, and I've decided to share the code on BitBucket, I need to tidy it up. Java resource bundles are the obvious choice. I can start with properties files and know that I can move the messages into a database, at a later date, with a minor code change. I don't plan to use a DB, but it's good to know that my i18n framework will not cause problems if I do.
If I'm making the code public I'll need a licence. I decided on the Apache 2.0 licence. This is a permissive licence that doesn't have the viral infection issues of GPL. I've pasted a header into every code module and updated the Mercurial repository. Eclipse has a useful comment template system, that will add standard templates to new modules, methods etc. So every class file I add will get a standard header, with the current year in the copyright notice and the correct date in the GroovyDoc / JavaDoc @date command.
Viewing the code on BitBucket is a little odd, it's too spaced-out. It's displayed using a tab stop every eight characters, whereas I prefer tabs every four characters. I assumed there'd be a way to configure this, but no. There is a work-around... you have to manually append &ts=4
to the URL, as described in Chris Wareham's comment on BitBucket issue #11111.
Find me coding on GitHub, networking on LinkedIn, answering questions on Stack Exchange and hanging out on twitter.