Wednesday, July 18, 2007

Is Log4cpp new, or has it been abandoned?

Any C++ programmers use Log4cpp? For C# we use Log4net for logging, and when I found that PC SMS used Log4cpp as it's logging framework I just assumed it would be as easy to configure as Log4net.

But Log4net has a very active user community, and the mailing list gets regular visits from the developers Ron and Nicko. No so with Log4cpp.

All I needed was a really simple basic setup to log to a file. Could I find anything? Well, would you find this useful, which says "The configuration file format is undocumented and may change without notice". Ok...

Luckily I found the log4cpp.properties file buried within the tests directory of the log4cpp download, which goes some way to giving the example I needed.

So, if anyone else is searching for the simplest Log4cpp configuration to log to a file, just use this:

log4j.rootCategory=DEBUG, FILE

appender.FILE=org.apache.log4j.FileAppender
appender.FILE.fileName=c:\filename.log
appender.FILE.layout=org.apache.log4j.BasicLayout

And no, that's not a typo, and I haven't cut and paste from the wrong file: Log4cpp uses Log4j stuff in its configuration file.

Revisiting comments

Back in May I wrote a response to a Slashdot article about writing comments. The jist of my response was that most times you can get away with not writing them if you write self-documenting code.

And the important part of this is the "self-documenting" part. C# lends itself very well to being written in an easy to read fashion. I can't say the same about C++.

Like most computing graduates I have had exposure to C++, but all my commercial (i.e. real world) experience has been in C#. Today I had to look at C++ code, and I didn't enjoy one bit of it.

Esendex's PC SMS download is a C++ Windows application that sits in the system tray, notifies you of new inbound messages and allows you to send SMS in much the same way as you would an email. It's been around for a while now, but I can't say I've worked on any part of it.

We had a customer today who reported that the application was having trouble with the initial connection. Having no experience in commercial grade C++ applications I found it very difficult to track down even how to switch logging on. A few comments here and there would have eased this greatly.

But I still don't believe source code should be swamped with comments. When you're working with a fluid code base (as you do with XP), code is continuously moved around as the design changes, and no one wants to maintain comments as well as code.

Thursday, July 05, 2007

Going Global

I must admit I wasn't expecting many people to read this blog when I first set out, but looking through my Google Analytics reports I've had visits from every continent now.

Judging by the stats most of you are just viewing 1 page (with the post about EventType dr20r3 leading the way) and are new visitors, but I don't mind that as long as you're finding something useful while you're here.

The returning visitors among you may have noticed a new search bar in the corner, and I debated with myself for ages over whether or not to include it. But, after manually scrolling through (often poorly labelled) posts, I thought it was about time to put one on and see how it looks.

Just make sure you select the "My Blog" radio button if you want to search just my blog.

Wednesday, July 04, 2007

New Developers in an Agile Team

Two new developers, Jonathan and Andy, have started at Esendex this past week, both fresh from university. I'm sure they'll start their own blogs soon enough, so watch this space.

It's got me thinking about the best way of introducing them to the work that they will be doing so that they can be productive as soon as possible.

Esendex developers are very agile for the most part--we're able to turn out new and updated tested functionality relatively quickly--but while this is great for the company and our customers I'm sure it must be overwhelming for a new starter.

Documentation helps, and we do have some which explains (in loose terms) the architecture of the internal messaging system, and how our system's tiers hang together. But for the most part knowledge is passed verbally, if only because the entire system is far too large to describe in documentation. After all, we'd do nothing but write documents if we had to document everything.

So the way we have introduced new developers before (and how I believe Andy and Jonathan will be introduced this time), is to get them exposed to the code as soon as possible, and let them ask questions so they get things straight in their own minds.

Pair programming and test driven development helps here, so they'll always have someone to direct questions at, and the tests should make it clear if something will break another part of the system.

I guess the key is to not flood them with too much information to begin with. People can only take in so much information at any one point, so introducing someone to part of the system they are not currently working on will only complicate things.

If anyone has any suggestions, or stories about what you do in this situation, then please leave a comment.

Alan Johnston Released

Alan Johnston has finally been released. Great news for him and his family who must have been going through hell these past 114 days.

I'll leave the banner on this site until he's back home safe with his family.