Archive for September, 2005

Ship It! Reviewed

Friday, September 30th, 2005

This is a follow-up to my post Ship It! Sneak Peek, since Ship It! arrived not too long ago and I couldn’t wait to take the rest of it in.

The introduction gives a short overview about the rest of the books and gives some tips on how to read the book corresponding to your role, either developer, team lead or manager.

The rest of the book is divided into four chapters:

  • Tools and Infrastructure
  • Pragmatic Project Techniques
  • Tracer Bullet Development
  • Common Problems and How to Fix Them

The first chapter introduces common tools that should work for almost, if not any project. Continuous integration, issue/feature tracking, scripting your build, having a test harness, and the like. You do these things, right? I liked the good and short explanations of the kinds of tests you can write, since it’s easy for the beginner (it was for me) to confuse e.g. smoke tests with unit tests.

The second one explains common techniques for projects. The most important one for me is “Work From The List”. It’s a list containing all features and tasks for the project including an estimate and a priority. Everything you need to get going, and to keep your project running. The rest of the chapter goes into good detail about having a tech lead, communicating on a daily basis, code reviews and code change notifications.

All mentioned techniques might sound familiar to you, if you’re pragmatic as hell. But the book is not just a list of techniques, it’s a about how these techniques work, why they work and why they’ll work for your project. Although most of the stuff is used in my current project at work, I got a lot of new inspiration on what we could do better from the first 2 chapters. I recently had an epiphany when I finally saw The List in front of me on a whiteboard. It was one of these moments that you’ll never forget, because you see that it just works and why it works at the same time.

Every technique explained in these chapters is accompanied by a list of things you can do to introduce it in your project, and a list of signs of doing it right and doing it wrong.

The next chapter describes a development technique called “Tracer Bullet Development”, a quite interesting approach to developing software. First your team agrees on specific layers for your project. Each layer gets a skeleton that just returns fake data. When all layers are stubbed out and talk to each other, each team can start adding code to its specific layer. The pieces slowly come together as all layers come closer to being finished. Well, that’s the short version, but it’s a very interesting approach for new projects.

The book finishes with a collection of common problems and little recipes on how to fix them, including inheriting legacy code, a broken test suite, team problems, and the like. Very good stuff, always comes in handy to solve those problems every project experiences from time to time (or, always, if worse comes to worst).

I was amazed that these five chapters only take about 160 pages and yet tell you all you need to know about successful projects. I’ve experienced a lot of these problems myself, and so did/do you, I’m sure about that. Jared Richardson and William Gwaltney have put together an excellent guide for both developers and managers. A must-read, if you have problems in your team or projects, and a must-read to confirm you’re doing the right thing. As both the authors do I can only recommend to get this book, find a best practice that could improve the way you and your team work and start using it to see if it works for you. If you want to start small, check out the selected excerpts of Ship It!.

Truly Understanding the Second-Level and Query Caches

Monday, September 26th, 2005

JavaLobby editor R.J. Lorimer has written a concise article explaining Hibernate’s second-level and query cache. A very interesting read. If you’re working with Hibernate, be sure to check it out.

Pragmatic Fridays

Monday, September 26th, 2005

Well, it’s not really Friday yet, but the Pragmatic Programmers released the first book of their new series of micro-books, called Pragmatic Fridays, anyway. Dave Thomas talked about them in the Ruby on Rails Podcast #2. They’re only about a hundred pages in size, PDF only (DRM-free, of course and cost between 7.50$ and 10$.

The first one is “Rapid GUI Development with QtRuby”, not surprisingly dealing with GUI development with the great Qt library and Ruby using the QtRuby bindings. Check out the excerpt. Perfectly suited for display reading which I tend not to like otherwise.

In the future we’ll see more Ruby-related micro-books

Great stuff guys, and keep ‘em coming!

Cuppa finally has Growl support

Sunday, September 25th, 2005

Cuppa 1.4.0 came out yesterday and finally got a decent support for the Growl notification framework. So if you’re like me, and tend to forget about your brewing tea while reading news working on something, get Cuppa and be sure to be notified once your tea’s done. It was fun adding the support for Growl. Objective-C is a beautiful language and Cocoa an awesome and great-to-work-with framework. So get it while it’s hot. Source code is available as well.

Germany has a Rails User Group

Saturday, September 24th, 2005

Finally, someone (someone being Jan Krutisch and Ramon Wartala) took a step forward and decided that it’s time for Germany’s very own Ruby on Rails User Group. There is a Weblog and a Mailing-List available for a start. Future plans include a network for German Rails-Users, a Wiki, and maybe other useful stuff too, like local meetings, talks, you name it. Come on in and join us to help spread the word about Rails in Germany.

Defensive Flushing with Hibernate

Friday, September 9th, 2005

We were hunting down potential performance killers in our application over the last few weeks. Everything came to mind from slow algorithms, ineffective class-mapping, even problems with Hibernate (the usual suspects, too many queries, inefficient SQL, and the like). Even using custom SQL came up, but what do you know, one single point of tuning was enough to give the all-over performance a tremendous boost. When using HQL queries in your application, be sure to disable automatic flushing wherever you can. Hibernate by default flushes all changes to the database, when you fire a query. And that includes dirty-checking all objects in the session cache. The profiling showed that most of the time was spent in QueryImpl.list() in most profiled scenarios. When you get to the bottom of it all you find Hibernate calling your object’s getters millions and millions of times. The number rises exponentially with the number of persistent objects you’re using in a single transaction. I don’t blame Hibernate for this, it’s just the way it works, and you have to know that.

So what can you do, if you need to query? Do what Jason Carreirarecommends and define your flushing strategy early. We didn’t do it, and we paid the price of having to find the problem later. So what we did is, whenever we fire a HQL query, we tell the session to flush on commit:

Session session = SessionFactory.openSession();
session.setFlushMode(FlushMode.COMMIT);
// fire your query

The result was overwhelming. The overall performance improved dramatically. We’re talking factors of 60. Of course we had to fix some code accordingly, but it was worth it.

If you do or plan on doing the same, stay clear of relying on flushed data in your code. If you changed some data without flushing the session explicitly, you might end up with inconsistent data when querying the database. The problems will become fewer, if you keep your transactions small. That’s why I can only recommend what Jason already recommended: Define your flushing strategy early.

Behind Closed Doors My Job Went To India

Tuesday, September 6th, 2005

The Pragmatic Programmers have two great new books coming up.

The first one is “My Job Went to India (And All I Got Was This Lousy Book)”. Reckoning from the sample excerpts and book’s description it seems like another very good companion to “The Pragmatic Programmer”, this time focussing one what you can do to save your job (or improve your skills for the next one). From the looks of it, Chad Fowler does a good at trying to motivate to constantly work and improve the way you think, work and learn. Every chapter ends with something you can and should do to improve the corresponding skill. It will definitely be a very good read. Check out his blog for some additional stories and bits of information.

The second one to come is “Behind Closed Doors - Secrets of Great Management”. This one focusses on the management side of projects. It tells the story of Sam and the leads dealing with and solving everyday management problems to make their project a success. It’s split into small stories which are followed by advice and corresponding practices. I skimmed through the sample excerpt’s pages and already started to think about what I can do to do better at work.

So both books will definitely be well worth spending money on. But “Behind Closed Doors” is better suited for people in management or wanting to become a project or technical lead. I recommend reading these books as a developer anyway, just like “The Art of Project Management”. There’s always something you can learn, and that you could improve in your team.

And you did get a copy of “Agile Web Development with Rails”, did you? Truly an amazing book about an even more amazing framework.