Tuesday, September 29, 2009

Thoughtworks seminar

This morning I attended a Thoughtworks seminar in Stockholm. The venue was piperska muren - a really nice conference centre at Kungsholmen. The founder of the company opened up with a short introduction of the agenda, the company and the speakers. 

First out was Ola Bini - one of the local employees - speaking - as he often does - about programming languages. He made some points about the usefulness of different languages - most of them valid I think. A typical application today uses a bunch of languages - think enterprise Java and you have at least Java, XML, HTML, CSS, Javascript and SQL. It is one language per technical need. So we are sort of used to different languages already. What we are not used to are different main programming languages. A system may be written using a bunch of different languages for its subsystems depending on the character of each subsystem. Coding a rules engine in Java may not be the best choice of language for example. I agree a lot with this. I would rather try new languages every year then continue to dwell in the Java trench. It would probably be good for the systems I work on and I would grow personally a lot more than I do now (repeating the same tedious tasks over and over). But I am not so sure this is a practical approach. The proportion of developers that are able to easily grasp another programming language is very low. Many developers I work with barely manages to get it right in Java but when they finally "get" it - it sticks. Is it possible to deploy a large number of languages in a large organization that "just" have average developers? I would like to say yes to this but I am not so sure.

Second - Martin Fowler. A great speaker to say the least. He held 3 different short talks. (1) First he talked about the value of software design. He made a lot of good and well known points. Software design is not visible to the users and customer of a system so it is not easy to make them pay for good software design. The way to go about it is to introduce the concept of technical debt (coined by Ward Cunningham) to the customer. Whenever there is a technical debt the customer can either decide to pay the debt up front (refactor the system) or pay interest on future investments (added functionality needs to live with and work around  limitations introduced earlier). And as interest builds up new functionality gets more and more expensive. He also did not agree on the difference between technical debt and mess as described in a blog post by Uncle Bob but rather thought of it in matters of whether the debt was deliberately created or not. Fowlers nondeliberate debt probably equals Uncle Bobs mess. A debt is always created in any software project since we can not know the design until after we are done. Software development is exploratory in its nature and it is natural that knowledge about the system comes to us progressively throughout a project. A comforting thought indeed. (2) The second talk was a proposal to use the pattern called "event sourcing" more in business applications. He argued that this concept - that developers use everyday while using version control systems makes a lot of sense in many business situations too. It solves the problems of history and alternative reality (branching) for us. Interesting but not applicable right now.... (3) In the third talk he took a step back and pondered on the nature of software projects and related it to the work of thoughtworks. There is a scale of software efforts from pure infrastructure of no competitive business value to core business software that may be the edge between a business and its competitors. A competitive and therefore expensive software consultancy like thoughtworks should look for the latter kind of projects - strategic projects where the payback is far higher then the increased cost of skilled developers. In these kind of projects there is a real point in using expensive and great developers. He finished of with a bit of self criticism wanting his company to work less with "crappy financial software" and more with stuff that makes the world a better place.

Third and last - Vivek Prahlad - one of the men behind Twist - thoughtworks automatic gui tester that also comes bundled with the continours integration tool Cruise (a commercial continuation of CruiseControl) and collaboration thing Mingle. He started with laying the theoretical foundation for this kind of testing. This includes the case against manual testing due to its inability to repeat the same test twice and that test is an issue for the entire team - not only for the testers. All this seems so nice and good but is seldom implemented for real. He then went on and demonstrated Twist and I must say that I was truly impressed. Too bad it ain't free - I want to implement it right away in my current project. At $3000 a year for 5 users it is still not expensive but harder to just slip into an organization where the procurement process is sacred. I will certainly recommend it to any future customer. Twist runs on top of selenium (and other test automation frameworks as well I think) and enables test cases that actually are readable by normal users. Built in the eclipse framework it features refactoring of test cases among other things. The generated code is easily accessible so that code generated by the recorder can be made tidy.

All in all - a nice couple of hours listening to people that knows software development.



Wednesday, September 16, 2009

sed to the rescue (or how to migrate from java.util.logging to org.slf4j)

I got the task to migrate all our code - some 100 classes - from standard JDK logging to the logging facade framework slf4j. (I am not sure if there are any real benefits from such a migration but the deploying organization has decided that this is the way to go so the best approach i to just look happy and accept. They also claim that there may be performance issues with the way we log now. It sounds a bit far-fetched to me....) A fast analysis of the task made me conclude that I needed to replace:
  • the import of java.util.logging.Logger with org.slf4j.*
  • the line constructing the Logger instance to use the slf4j LoggerFactory instead
  • .fine, .finer and .finest with .debug (for some reason .debug is the finest level in the slf4j API)
  • .warning with .warn
  • .severe with .error
A tedious work to do by hand. Thankfully there is a nice little unix command called sed that together with find does the trick almost perfectly. Here is the script I used:
#/bin/ksh
for file in `find . -name '*.java'`
do
cleartool co -c "Changing log framework thingie." $file
sed -e 's/java.util.logging.Logger/org.slf4j.*/' \
-e 's/= Logger.getLogger/= LoggerFactory.getLogger/' \
-e 's/.fine(/.debug(/' \
-e 's/.finer(/.debug(/' \
-e 's/.warning(/.warn(/' \
-e 's/.severe(/.error(/' \
$file > $file.tmp
mv $file.tmp $file
done
As you can see I also added a line to check out the file from Clearcase. If you are using CVS, subversion or even git (as any developer would given a free choice....) there is no need.

A couple of files failed to compile after the migration. Curly braces disappeared at the end of some classes and in one case the logger was instantiated on 2 lines instead of one but overall it worked nicely.

This way of working comes rather natural to me but I gather that not all developers think of the command line as a helpful tool and thus this blog post.

Friday, September 11, 2009

svn remote diff

Here is a question for you. How come that there is no remote diff in subversion. I can use
svn status -u

to check which files are changed remotely. But there is no similar -u option for diff. Or a --dry-run flag in update which shows the incoming diffs. Is there a reason for this? Do you not also sometimes want to know what the incoming changes are - BEFORE you issue the actual update?

The best solution to the problem so far I found on this blog.

Has anyone a better solution? Or an explanation why this is not part of the standard svn command set?

--Hardy

Monday, September 07, 2009

JDiskReport.

My MacBook Pro turns soon 1 year and I thought I do a little health check. This includes checking where all the disk space disappeared over the last year. This is where one of my favorite Java tools come into play. I don't use it so often, but when I want to find out what takes up so much space on my drive, there is nothing better than JDiskReport. In my case there were several unused VMWare images. A quick delete and I reclaimed more than 15GB! I recommend you run JDiskReport against your home directory. I am sure you will be suprised :)

--Hardy

Saturday, September 05, 2009

Design matters - period!

I have been writing before about my struggle with the some the machines
we have to deal with on a day to day basis. My latest frustration is with the new payment system of Västtrafik (Göteborg's tram and bus operator). Initially I thought it's just me, but the new ticket system has gotten quite some press over the past few weeks. Well, at least here in Göteborg. I am sure a "Stockholmare" couldn't care less ;-)

Funny enough the people in charge at Västtrafik went from denying any problems to admitting errors to extending the grace period of the old system. In my opinion there are several issues with the new system. I don't mind that there is a deposit on the new re-chargeable travel card (other people seem to have a big issue with that). I am more concerned about that even the tram and bus drivers cannot explain the new system. And believe me - I don't blame them. Here is a picture of the new system installed on all trams and buses. WTF?



A yellow box with the symbols '+', 'T',  'V', 'S', '?', 'Å', 'K'. I don't get it. And is there some grouping of the buttons implied? Or was it just the easiest way to wire this yellow monster up?
Registering a simple single trip is admittedly quite simple. Just hold your card into the center of the machine. Pretty obvious, no? There is a big hand holding a card. I call this a good visual cue. But what if I want to travel multiple zones, or if I want to pay for a friend? Hmm, maybe I press the '?'. That could be the help system, right? Nope :( So is it the '+' to pay for two? I am thinking adding another person. Nope. That's for adding zones. But hey, why is that a '+' and not a 'Z' for zone. To add another person you have to press 'V' like vuxen (adult). So what do all the other letters stand for. To be honest I still don't know.

Västtrafik paid millions for this system and was years behind in introducing it and this is all they can come up with? Personally I would fire the person in charge! At the very least I would force him to read Garr Reynolds Presentation Zen blog. I am sure he could learn some valuable lessons there. Especially that design matters. This might also stop him from saying things like:"Jag var själf med i en referensgrupp för utprovningen och jag upplevde det som enkelt. Systemet är pedagogiskt och enkelt att lära sig" (I myself was  in an evaluation group and I experienced the system as easy. It is pedagogic and easy to learn). What a joke. I am sure Västtrafik's passengers would have been much more easy going with the new system if it would have been easier to understand.

Here a a few ideas. Replace or add images to the buttons. Come up with some decent visual cues. Also think about foreigners. How would they ever what these letters stand for. Another idea could be to replace the display with a bigger one which allows to display some more help text. And if everything fails put big signs next to the machine. And for heavens sake, take responsibility and admit that you screwed up.

--Hardy

Thursday, September 03, 2009

GTUG meeting

Google Technology User Group Stockholm had its first meeting this evening. It was mainly a one man show featuring Peter Svensson showing us the really cool Google technologies Wave and Android.

Google Wave is really an interesting concept. Incorporating mail, wiki, chat, micromessaging and whatnot in one service - it promises to maybe, maybe be a killer app of the next few years. The API includes the possibilities for anyone to build gadgets and robots that can enhance the experience. Peter showed a map gadget where he added map points simultaneously with a member of the audience. And the robot example was a dice that responded with results to d6 etc in text written by wave participants. To make sure it may be embraced by anyone Google has made the specs public and they plan to open source the wave engine so that anyone can setup a wave server (would be great as inhouse groupware (now thats an old word.....) for larger orgs). I have an early bird account but I haven't got around playing with it anymore yet - might in the future. The GTUGS might organize a hackathon dedicated to waves - a great opportunity to try it out a little bit more.

Android is not news of course since myself and hardy actually built an application for the first android developer contest. It didn't won but ended up in the top 25% - good enough for my ego. The way of working with it is slowly coming back to me while listening to the talk. It is a nice API conceptually - makes it easy to get into the mobile world. What I didn't like about it when coding was the strange usage of XML.

Anyway - it was a nice evening in Ottobonis nice 13th floor office and I will surely turn up in the future as well.

Tuesday, September 01, 2009

Kebnekaise 2009

Since Fredrik blogged about his trip to France, I cannot resists to blog about my trip to the North of Sweden - the Kebnekaise region to be precise. Even though Anna and I only stayed for 5 days in the Fjällen, it was extremely relaxing. Away from all these things which make our live supposedly so much easier, it was time to reconnect with nature and just enjoy piece and quietness. Being completely offline was just a bliss. It is amazing how simple life can be - walk, cook, sleep. Repeat! Below you can see some of the pictures (Anna posted some more pictures here).






The core data. Don't forget, I am still a number person :)

Total walking distance63.2 km
Total walking time17:59 h
Resting time08:22 h
Walking average3.5 km/h

We walked in from Nikkalukta and put up our tent a couple of kilometers outside the Kebnekaise Fjällstation to avoid the crowd there. From there we took several walks including a climb of the Kebnekaise summit via the western route. It took us over 11 hours and taught us that on Swedish hiking descriptions the recommended times (in this case 12 hours) are quite accurate. In other parts of the world, for example Australia, we used to be able to just half the estimated walking time. Or are we just getting old? For the real data nerds I tracked the whole trip using my GPS. The route contains the track from Nikkalukta to the Fjällstation as well as the western route up to Kebnekaise. I marked our camp spots and some other points of interests. You can download the gpx file here. As far as I could find out I am there first to release the western route track in a GPS consumable format :)

Regarding the packing we stuck with the packing list found on kebnekaise.nu and I must say it served us well. Well done!

A word about the food. We decided against all these freeze tried hiking foods. They may have a purpose if you climb the Mount Everest, but when walking in the Swedish Fjällen they are just stupid and face it - most of them taste crap. Instead we packed some packages of rice and noodles, some tuna cans most importantly some fresh stuff like aubergines, zucchini and capsicum. Boil some rice, add some chopped veggies and tuna and off you go. Depending on the time of the year you can even pep up your food with some picked mushrooms or berries (we saw a quite a lot of cloudberries, but unfortunately they were not ripe yet).

I also would like to congratulation the team of the Kebnekaise Fjällstation. It is one of the best run STF hostels I have seen so far. I think other hostel owners should plan a trip up there themselves and learn!

--Hardy