Archive for October, 2005

“Pro Hibernate 3″ review

Pro Hibernate 3, by Jeff Linwood, Dave Minter (Apress)

The good stuff:

  • Clear and consistent.
  • Very few errors (spotted just a couple, minor ones).
  • Good typography.
  • The authors know their stuff, and it shows.

The not so good stuff:

At 242 pages, this book is too thin. No, let me restate it: it is way too thin. I’m not particularly fond of very thick books, but when the subject matter is complex, you simply can’t get away with a cursory glance at its intricacies. You see, at 408 pages, I still think that Hibernate in Action, though it is probably the best book on the subject, would be just great if it packed a few more pages.

The problem with Hibernate is that beneath its apparent simplicity lie a large number of difficult problems. Don’t get me wrong, I still think Hibernate is the best ORM tool out there. Unfortunately, Object-Relational Mapping is a hard problem. Solving the Object-Relational impedance mismatch in a fully transparent way is probably impossible: all proposed solutions so far are, in the end, yet another abstraction layer. And as we all know, all abstractions leak, one way or the other.

If you are just beginning to approach Hibernate and think that you will get a decent coverage of the complexities, traps and pitfalls of a tool like Hibernate in just 242 pages, you’re bound to be disappointed. Here are just a few subjects that I would have liked to see covered much more deeply:

  • HQL syntax. The official Hibernate documentation already gives some more complex samples, but their explanation is too concise. A good complement to the docs should probably clarify what you can and what you cannot do in HQL.
  • Exotic mappings.
  • Tuning and optimization.
  • Caching. What are the benefits and drawbacks of the various caching strategies and implementations?
  • Lazy loading. It is my experience that novices sooner or later will get the dreaded LazyInitializationException. What techniques can be used to avoid it?
  • Cascading rules and their effect on the lifecycle of entities.
  • Bulk loading and saving.
  • Using versioning to implement optimistic locking.
  • Others that I don’t remember at the moment.

All in all, I don’t think this is a bad book. Quite the contrary. It’s just that I think the authors could have dispensed some more of the goodness they are evidently capable of. As it stands, you will at the very minimum need to have a copy of the official Hibernate documentation, plus Hibernate in Action, on your desk, together with Pro Hibernate 3.

ApacheCon Super Early Bird registration reminder

ApacheCon US 2005Just a reminder that you have only a few hours left if you want to take advantage of the Super Early Bird registration prices for ApacheCon. Don’t miss the opportunity! The deadline is 11:59pm PDT, Friday, 28 October 2005.

Minding the Planet

Minding the Planet: Want a Link to Your Blog from Minding The Planet?: “Hello readers! I am trying a little experiment to see who is reading this blog. Anyone who posts a link in their blog to the permalink of this blog entry will get a reciprocal link back to their blog from within the body of this blog entry. I’ll search periodically for sites that link to this entry, and when I find new ones, I’ll add links back to them from this entry.”

There you go. Nice blog, by the way, but I support Peter’s request: Provide full feeds, please.

“File -> Save” sucks

Adrian Sutton: “Expect to see a lot more of that as applications take better advantage of CoreData and/or provide built-in versioning systems for their files. When you think about it, why should you have to remember to save instead of just having the ability to undo as far back as you like?”

It’s not the first time I hear this. I can’t remember who already wrote very convincingly about this subject, but the basic idea is that the traditional “File Save” operation of GUI applications is terribly botched. Users should never be forced to remember to save new and modified documents. Also, having to put the file in a specific directory inside a hierarchical filesystem is something that most users would like to be spared of. Applications should provide automatic save and versioning. Documents should be retrieved by search and not by looking at long lists of file names.

I can see this very clearly now that my daughter (7 years old) is starting to use TextEdit on my Powerbook to write little stories or poems. Opening the program or existing documents is very intuitive: you just click (or double-click, harder) on them. But I had to teach her to always save her documents before quitting and still I find myself remembering it to her once in a while.

I’m glad to see that Apple, with CoreData and Spotlight, seems to be ahead of the curve on this issue.

How do I produce well-formed XML with Velocity?

The title pretty much says it all. I’ve been reading the docs, googling around and asking the only person I know who actually likes Velocity, but I could not find a solution to this simple question: Is it possible to guarantee that the output of a Velocity template will always be a well-formed XML document?

Of course, the template must have all tags balanced and such, to start with. Consider this simple template:

<tag>$value</tag>

As long as the string representation of the value variable in the Velocity context is something innocuous as “foobar”, everything is fine. But if it were “foo & bar” instead, you’d get this output:

<tag>foo & bar</tag>

which is most definitely not valid XML! The correct output should have been:

<tag>foo &amp; bar</tag>

This makes me wonder: Do people who use Velocity to generate Web pages never need to generate valid XHTML pages? I simply can’t believe this!

So there must be a solution. Of course, there is a really obvious and bad solution, which is going over all the values passed into the Velocity context and escaping all XML special characters like ‘&’, ‘<’ and so on. This might work for a simple case like the one above, but would break down horribly when your data model is a complex collection of arbitrary objects.

Please, don’t tell me that Velocity sucks as much as I think it does!

“The World is Flat” review

I might be treading on dangerous waters by reviewing Tom Friedman’s latest book “The World is Flat” (Farrar, Straus and Giroux, ISBN 0374292884) instead of the usual computer books. I am no economy or geopolitics expert, so I might be flamed for writing something really stupid, but after all this is my blog, so I’m allowed to say anything i like, right?

First of all, I liked the book. Not as much as “The Lexus and the Olive Tree”, which I found more varied and lively, but still I think it’s a very interesting and stimulating book.

I also do not agree with some of the critics, who pointed out that the world is still round and that there are many inequalities yet. To say so is to overlook the fact that Friedman himself admits (p.375: “Indeed, this is the point in the book where I have to make a confession: I know that the world is not flat.”) the same.

The one point where, in my opinion, Friedman downplays the risks to the flattening of the world that are brought by globalization itself, is when he talks about the impending energy crisis caused by the growing of China’s, India’s and Russia’s economy (”Too Many Toyotas”). He dedicates too little space to this problem and it is obvious that he has no real solutions to propose. But on the other hand, who has them?

As a geek and Open Source advocate, I obviously appreciate the importance given to Open Source as one of the “ten flatteners”. I would just like to object to the statement that “In 1991 […] Linus Torvalds […] posted his Linux operating system to compete with the Microsoft Windows operating system.” In 1991, Windows was at version 3.0: not much more than a graphical shell on top of MS-DOS and nowhere near complete dominance of the desktop market. We all know that Linus wrote Linux because he wanted a free Unix-like operating system to play with and Tanenbaum did not want too release Minix for free. I don’t think the existence of Windows played any role in this.

Apart from these minor critiques, I recommend “The World is Flat” to anyone wishing to understand where this world is going. You might not agree with everything that Friedman says here, but it will surely give you much food for thought.

Joel on AdSense gets it (partly) wrong

Joel Spolsky: “It is important to remember that AdSense is just one part of Google’s revenue. A more significant part is AdWords, which covers the ads that appear on Google’s own site. AdWords are still susceptible to some fraud, although you can’t make money clicking on those ads, so it’s much less of a problem. There is a minor problem where advertisers hire clickers to click on their competitors’ ads, which cause their competitors to waste money, but that’s penny-ante stuff, and rare enough that advertising through AdWords still works well.”

OK, there’s a bit of confusion here. AdSense and AdWords are just two faces of the same program. If you are an advertiser, you subscribe to the AdWords program and your ads might go on Google’s search result pages, on other Google property like Gmail, or on pages of web publishers who subscribed to the AdSense program.

AdSense is not part of Google’s revenue. All ad revenue to Google comes in from advertisers using AdWords and aprt of it is used to pay AdSense publishers.

Apart from this minor point, Joel’s analysis is correct. And worrysome for advertisers, small publishers and Google alike. I can attest that Google takes click fraud very seriously, to the point that sometimes their net catches some innocent bystanders, together with the fraudulent clickers. But this might indeed be an unsolvable problem, in general.

Tempted by Rails

rails_logo_remix.gifI’m really starting to think that I need to freshen my development skills. Even after many years of programming, becoming more and more of an architect (whatever that means) does not imply that one should stop coding or learning new languages and techniques.

One of the most intriguing new languages is of course Ruby and its amazing (according to most observers) Rails web application framework. Being reassured that such a simple technology is not simplistic and can compete with complex J2EE servers in terms of scalability and reliability is comforting:

Jon Tirsen: “For a production management system of this caliber in J2EE you would pay hundreds of thousands of dollars and the cool thing is that SwitchTower actually has features not even the big iron appservers managed to implement. SwitchTower allows for pretty much complete 24/7 including completely seamless upgrades (and rollbacks) where the user wouldn’t even loose the session. How could the Rails team pull this off when companies like BEA and IBM never did regardless of how many millions of dollars and manyears of effort they’ve poured into their software?”

What is still holding me back is the fact that, by choosing Java for my next project, I am not just choosing a language and a platform, but also an incredible amount of libraries, frameworks and toolkits. For most problems you will be facing while developing a Java application, there is probably some library out there that solves it brilliantly, is Open Source and good quality too.

Case in point: I am a big fan of the “Search, Don’t Sort” approach and whenever I need to add a search feature to my apps (which happens almost always) I know I can use Lucene, which is real good. Or I can use Rome for reading and publishing RSS/Atom feeds, as I did recently. And having an RSS feed is the hallmark of any decent Web 2.0 (sorry, Joel) application, right? ;)

So, the only thing that worries me a little is: will I still be able to tap a comparable reservoir of code when I implement my next Web application with Ruby on Rails? Just wondering.

Update: later today, Brian McCallister announces:

David Balmain has released Ferret unto the world. Ferret is one of the most requested libraries I have seen for ruby — a native port (not a gcj and bindings!) of Lucene!

How Much is Your Blog Worth?


My blog is worth $23,146.14.
How much is your blog worth?

Not bad, but don’t expect me to go find someone who would spend $23,164.14 for this blog. I still hope that, in the long run, it will earn me much more than that in hardily measurable assets like name recognition, business contacts and fun. Am I being too optimistic?

(Via Pharyngula)

The final result matters

Woke up this morning to find two posts that echoed a common feeling:

Jonathan Schwartz: “As a software guy, here’s a simple (though often irritating) rule behind user oriented software: The language in which a product is written has nothing to do with the value it conveys. Coming from the company that produced Java technology, that probably sounds a little odd. But it’s a simple truth, especially when it comes to users: if the app’s no good, it’s no good, even if it’s implemented in Java. Or PHP. Or Rails.”

Ted Leung: “While I was watching the videos, some part of my brain overrode a bunch of things that I’ve spent a bunch of time writing about on this blog. Did I care that Aperture is written in a low level, mostly static language like Objective-C? Nope. Did it bother me that I couldn’t get the source code, or access the community of developers? Nope. I’ll probably change my mind about that once I return to my senses. But the visceral reaction that I had to Aperture is a big reminder that the final result matters a lot, not just the process and technology.”

OpenOffice and Aperture are creating value for customers and that’s what matters, certainly. On the other hand, I’m feeling just a bit let down because I cannot run OpenOffice on the Mac (not with the same quality as on other platforms anyway) and cannot run Aperture on Linux. And I cannot run Google Earth on either the Mac or Linux. But I can run Google Maps, Flickr and Basecamp on either OS X, Linux or Windows, without effort. And sometimes this is just what I need, even if the experience is less than perfect.


Most useful Dashboard widget ever

Tranquillus: “All this widget does is kill the Dock process (which Dashboard is a part of). MacOSX will automatically restart the Dock but without Dashboard in memory. Press F12 to start it up again.”

stopdashboard.pngI like this. Now I can be sure that stupid, useless Dashboard is not using any memory. Konfabulator is so much better.

(Via TUAW.)

Tech Execs Should Speak Out for Science

Dan Gillmor: “Powerful people should be defending science. Why are so many so silent?”

Right on the spot. I just want to point out one tech exec who recently spoke out for science and against Intelligent Design, Adam Bosworth:

It is time to speak up. It is time to say that facts are what matter, not faith, that human progress is accomplished through unfettered use of reason and inquiry and tolerance and discussion and debate, not through intolerant and irrational acts of terror or edicts. For all of our children and for the future, speak up against this wave of intolerance and irrationalism washing over the world.

Bravo!

OSZone Planet

oszone-beta.gifIt’s been a while since I have been doing anything about The Open Source Zone. You know the story: new job, new responsibilities, little time for blogging or side projects. But I finally found some time last weekend to introduce a new feature, one that I wanted to add from the beginning: A news aggregator.

So let me introduce to you OSZone Planet, an aggregation of the best news channels and blogs about Open Source. There’s not much there yet, actually. You just get the most recent items from a predefined set of channels, but I plan to introduce more features, like personalization — you will be able to select the channels you want to read — and an aggregated RSS feed, and more, in the coming days.

Also, it will be possible to submit new channels for inclusion. For the moment, if you know of a news site or blog that should be included, and it has an RSS/Atom feed, please let us know and we will add it.

On the technical side of things, there’s not much to say. I used Rome as the basis for the aggregator and it worked perfectly, at least from version 0.7 beta (version 0.6 had a little too many bugs to be seriously usable). I didn’t have to add much to what is already provided by Rome. Kudos!

The Perfect Christmas Present

… for me would probably be a new iPod, but if you don’t want to spend that much, what about Bruce Springsteen’s Born to Run 30th anniversary edition?

born2run-tcg-button.gif

I remember when I bought it first, on vinyl of course, many years ago. It was the first time I heard the Boss and it was a shock. After 30 years it’s still one of the greatest albums in the history of rock.

At the time, it was hard to listen to rock’n'roll on the radio and totally impossible to watch it on the TV. I had to wait until 1983, when Bruce did his first Italian tour, to be able to see him live. This edition includes two DVDs, a “making of” documentary and the recording of a 1975 concert in London.

However, since it will be released on November 15, I’m not sure I want to wait until Christmas to put my hands on it.

Top 100 English-language Novels

Today’s meme is: Indicate which books from Time’s list of top 100 English-language novels from 1923 to the present you have read. Since English is not my mother tongue, I must be forgiven if my list isn’t as complete as someone else’s.

  • Animal Farm
  • The Big Sleep
  • The Catcher in the Rye
  • The Confessions of Nat Turner
  • The Crying of Lot 49
  • The French Lieutenant’s Woman
  • Gravity’s Rainbow
  • Herzog
  • Lolita
  • Lord of the Flies
  • The Lord of the Rings
  • Neuromancer
  • 1984
  • On the Road
  • Ragtime
  • Snow Crash
  • The Spy Who Came in From the Cold

Two Pynchon’s and two Orwell’s. I don’t know if that means something.

To my personal list, I would surely add “The Hitch-Hikers Guide to the Galaxy” by Douglas Adams, “High Fidelity” by Nick Hornby and something by Robert Heinlein, Tom Wolfe (”The Bonfire of Vanities”) and Tom Robbins. Not exactly classics, though, but neither “Neuromancer” nor “Snow Crash” are.

(Via Andrew)

Google Earth for Linux

Computerworld: “A number of people are now working on a Linux port of Google Earth, but Rasmussen did not offer a release date.”

How about a Mac port instead?

Top Ten Weblog Design Mistakes

Jakob doesn't like itHere are the Top Ten Design Mistakes in Weblog usability, at least according to usability guru Jakob Nielsen:

  1. No author biography (a lack of a descriptive ‘About’ page)
  2. No author photo
  3. Nondescript posting titles (no microcontent)
  4. Links don’t say where they go (link text such as ‘here’ or ‘there’)
  5. Classic hits are buried (no chance for newcomers to find popular posts)
  6. The calendar is the only navigation (no categories)
  7. Irregular publishing frequency
  8. Mixing topics (not becoming a niche blogger and expert of a chosen field)
  9. Forgetting that you write for your future boss (flames/ rants don’t look too good once your prospective employer googles you)
  10. Having a domain name owned by a weblog service

Let’s see how we’re doing here. I admit being lacking on #5 (on the other hand, which posts are classics here?), possibly #7 and of course #8, but I score pretty well on all the other points. So why don’t I have thousands of visitors each day, Jakob ;-).

Also, why is it that most lists of do’s and dont’s always end up having exactly ten points?

Test post

This post is made in order to test a new aggregator. Please disregard.

Flying Spaghetti Monster car plaque

FSM_200.jpg

Coming Soon!

For all the Pastafarians out there! Molded black plastic, 5′ long, raised chrome, adhesive strip.

(Via Skeptico.)

Ben Hammersley on RSS, Web 2.0 and the Future of Media

Marcello and BenLast night I went to Milan to attend a talk by Ben Hammersley on RSS, Web 2.0 and the Future of Media.

Ben is a brilliant speaker and the subject of the speech was interesting and provocative enough, at least if you haven’t been already exposed for a while to the discourse about RSS, blogs, the Web 2.0 hype, podcasting, citizen journalism and the like. To some people in the audience, it sure seemed provoking, judging from the questions. The idea that the business model of mainstream media is completely screwed just didn’t sink in to most people, yet.

To me and a few others it was more like a reminder and nice summary of what it’s all about.

Many thanks to the Java User Group Milano for organizing the event. They did a good job of promoting it, as there was standing room only, even though the room was rather small. I guess more than one hundred people attended and about thirty of them turned up for the subsequent “pizzata”.