Review: Apache Wicket Cookbook by Igor VaynbergBy Christian Grobmeier on
Igor Vaynberg is wellknown in the Apache Wicket Developer scene, since he is a core developer of this framework. From Packt Publishing I have got his new book with the title Apache Wicket Cookbook. I was very exited to get it. As some of my blog readers know I have evaluated Wicket in the past and finally moved on to Struts 2. Reason was, documentation is really worse and the highly complex code you need to write for trivial sometimes. Some people still claim Wicket development is easy, but I say it's not. In my expectation Igors book will answer several questions I could not solve so far. Apache Wicket Cookbook covers version 1.4.x of Wicket. For the upcoming version 1.5.x you can expect some changes. Wicket does not care much about backward compatibility when increasing the middle number.
You'll need to have learned some basics in Wicket before this book is of help.
The table of content holds what the title promises: this book is a real cookbook. Every chapter contain several articles in the style of How-Tos. It's really a joy to read through them. Structure is always the same: use case, preparations, problem solving, explain, pitfalls/comments and reference. A big plus for readability.
The topics of the book are Validation, AJAX, Forms, Localization, some displaying stuff, charts and security. Most common problems are covered. A chapter with Wicket design patterns is even available online. Even integration with Middleware is covered. But clearly Spring, Dependency Injection and JPA has no focus. Wicket is a frontend framework and on nearly 260 pages out of 290 cover frontend development.
Lucky me, while Wicket does not following coding conventions by Sunracle, this book does. Thanks.
Another very good thing is, Igor doesn't try to be a Edgar Allen Poe. No clutter. Just the facts. That's good. For a cookbook, which should be on your desk while you work, it is pain to read the same joke for 10 times. Instead of joking, Igor simply explains what's going on. No Clutter and no mess - again a big plus. Wasn't it Hermann Hesse, who said an author must delete everything from his writing which is not important? Igor has made that very well.
When I read through the Captcha example, I Igor referenced the wicket-extension package. From there I took the captcha classes myself, long time ago. It was the first time I could have made use of this book in old times.
I have managed it to work it out for my application in a pretty fine time. This was the first time I really could have used Igors book. It's not witchery what he describes here, but its pretty helpful to get the right pointers and an explain. It saves time. I would have expected text like that in the Wicket documentation, to be honest. From chapter to chapter the Apache Wicket Cookbook feels more like the "missing manual". That being said, the Validation and Form chapters take already roundabout 70 pages. I have not found a question which is unanswered. No surprises if you have made it before, but sometimes you simply forget and then this book come to save you.
Similar experiences with the chapter of localization. Nothing new - localization is even fine in the docs. But sometimes you find some gems, like how you can debug resource loading. This was very helpful.
Very good was the DataTable chapter. There were some stuff inside which I have not explored yet. While I showed my Data already in the DataTable, i have not sorted it. It was very easy to see how it works - Igor did it with a plain Comparator. Guess this is, what people mean, when they say "Wicket is easy". But hey, look for yourself. There is a sample chapter online.
But how can I make use of jQuery? After reading the whole AJAX chapter (and the charts) I have the chance to work it out myself, somehow. But an example would have been nice and jQuery (or whatever) is an often used lib. The whole Web 2.0 stuff is so important, I would have loved more examples - compared to the Validation/Form chapter it feels a bit incomplete.
Security chapter explains authentication to you. It seems to be based on the examples again. My login components look very similar. Igor even explained how to secure pages with Annotations, which I actually did prior the book. This is a real life example. Very cool is the OpenID example. That's really fantastic. Igor also explains a bit on the RequestCycle - but I would like to read more on that. The RequestCycle is critical for Wicket. Understanding it helps you to deal out with many problems, imho.
The middleware chapter and shows you how you can implement your database. It's pretty short, but you can make your steps. Even when you use tools like Apache Cayenne, you can benefit from this chapter. Anyway, it's clearly not the focus of the book adn that's OK.
So after reading, what is the Outcome?
Igor wrote an excellent book. It's good to read and perfect to understand. Standard tasks are all explained very well. If you want to build up an application from scratch, here you go: for nearly each task you can find a solution. A bit more pain you will feel when you leave the standard path.
I have a few more questions I would like to see in this book: How can I create simple configuration files? Wicket is not offering anything - but how do Wicket Pros solve this?
I would also like to learn how to extend the RequestCycle itself. In the Security chapter there is a bit stuff in that direction, but it would be cool to learn more. But the subtitle of this book is about solving common problems. Probably this is not common enough.
How do I organize my Wicket application? This is more a global topic, I know, but still important. Should I separate my HTML files to another folder than my class files? How to organize my component packages? When to use panel, when not? And so on.
Anyway - this book is excellent. If you work with Wicket, you need a copy. You have simply better chances to work things out if you have it on your desk. If you are a beginner Wicket Developer, then you should first play a bit around with the docs and do some basic stuff before you solve your problems with the Apache Wicket Cookbook.
I really hope Igor will write a new version with more examples when Wicket 1.5 is out. And hopefully he adds some more answers oto my questions. Thumbs up, well done.