Archive for December, 2007

Joomla! has an odd ecosystem

Wednesday, December 19th, 2007

Continuing on in year-end odd-project mode, I’ve found myself poking around Joomla! for a client. After working with a variety of Perl, Java, PHP, Python, and Ruby projects over the last 10 years, it’s very strange to find an “open source” project where significant chunks of project-related code are in some way proprietary.

For example, the first calendar component that pops up on my searches is licensed under the GPL, but costs $5 to download. The authors explain that this all makes sense because the files for the component are available at joomlacode.org. Maybe yes, maybe no, but I think there’s good reason this isn’t a common pattern. The $5 introduces some friction into the whole system — while it isn’t a significant amount of money to exchange for something that’s going to save development time, it forces the developer to find their wallet, dig out their credit card, and type in a bunch of numbers, all sight unseen. Multiply this friction for everyone who might come in contact with the code, offer patches, bug reports, etc. I can’t imagine things working this way in any of the other open source project communities I’ve worked in.

The calendar certainly isn’t the only example; the only tag component I can see is a proprietary component, complete with a graphic of a software box and at least a half-dozen “Get your copy - Download Now!” (for £ 25.00 + VAT) links on its home page. A little searching reveals some interesting perspectives from commercial component developers.

None of this is to say that the Joomla! community’s approach is inherently wrong, but as a developer thinking about doing some work with Joomla!, I’m motivated to reassess other, more conventionally Open Source options.

First thoughts on CakePHP from a Rails perspective

Friday, December 14th, 2007

I have a new project coming up that seems like a great fit for Ruby on Rails, particularly the RESTful interfaces that have gone in over the last year. However, the typical questions about using Rails apply here: I’m not sure how well the project’s hosting environment will support Rails, and collaborators aren’t as familiar with it. Thus, it seemed like it might be worth another look at options on the PHP side of things. I keep hearing that CakePHP is Rails-inspired and has many of the same advantages, so today I’ve taken the stable version (1.1.8.5850) for a spin, letting the Cake manual’s blog tutorial get me started. Here’s what I’ve noticed about CakePHP development as practiced in the tutorial — maybe there’s better ways to do things & the tutorial just isn’t mentioning them?

  • No migrations; you have to generate the DDL on your own, both initially and for any subsequent modifications. Also, no model or controller generators. It’s definitely nicer to just do script/generate scaffold post title:string body:text; rake db:migrate and be off to the races — from Rails 1.2 on, those races include the whole REST business. To be fair, there is a one off reference to ‘bake’ scripts in the CakePHP manual, but no pointers on what those are, or where they live, and the website isn’t much clearer.
  • No TDD. Woah. That’s, like, half the advantage of Rails — automated testing is right there in your face, and is firmly entrenched in the community.
  • PHP code is not quite as elegant as Ruby. For example, generating a link to delete a post looks like this: $html->link('Delete', "/posts/delete/{$post['Post'][id']}", null, 'Are you sure?' ). Can you spot the syntax error? Probably you can, but it took me a good few minutes. The Rails equivalent would be
    link_to "Delete", { :action => "delete", :id => @post.id }, :confirm => "Are you sure?", :method => :delete
  • A lack of the experiences baked into Rails. For example, after the Google Web Accelerator fiasco, it became common practice to make all links to destructive actions happen via POST, which can be done via link_to’s :method parameter. Compare to the GET-powered delete link above, straight from the Cake tutorial.
  • I miss my vim & rails integration, which makes creating and navigating the various files a breeze. (Glad I went to the trouble of making that a link, as it got me re-reading the plugin’s about page, and I saw the parts about partial extraction and migration inversion, neither of which I’d noticed before)

On the upside, using CakePHP sure beats writing a CRUD-heavy PHP application from scratch. One of my current projects, a completely custom contact management application, would be in much better shape if it were using CakePHP instead of the project-specific ORM I cobbled together — I’m going to have to give conversion of that project to CakePHP some serious thought.

But is CakePHP a DSL for the web in the sense that Rails is? Not yet.

Don’t worry, be happy about the state of the environment?

Wednesday, December 12th, 2007

I’ve been meaning to review Jared Diamond’s Collapse and James Howard Kunstler’s Long Emergency for a while. Now that so-called environmentalists Ted Nordhaus & Michael Shellenberger have done me the favor of including both in their recent what-me-worry piece of sophistry, I have an excuse to cover both in one swoop.

Nordhaus & Shellenberger’s characterization of recent environmental writing, including Kunstler & Diamond’s works, is that they consist of “the tragic narrative of humankind’s fall from Nature.” This hardly applies to Kunstler; the tragic narrative he writes is of America’s addiction to cheap fossil fuels, which doesn’t go back more than a century or so. I don’t recall a single passage from Kunstler’s book that shows any concern for the idea of capital-N Nature that has Nordhaus & Shellenberger so agitated; instead, his utopia revolves around sustainable communities whose citizens thrive without depending on abundant fossil fuels.

It’s not a very good characterization of Diamond’s work, either. He examines a number of small and old civilizations and shows where they came up short against natural resources. Nordhaus & Shellenberger suggest his argument requires that “the Greenland Norse…convened tribal councils to choose collective suicide”, which is of course ridiculous, and also not something Diamond ever claims. He does talk about societies choosing how they respond to environmental challenges, but not in such a literal-minded way. Instead, for example, he shows how the Greenland Norse continued to depend on forms of agriculture that worked in Norway but clearly weren’t sustainable in Greenland’s harsher climate.

Honestly, I was hoping that the Nordhause & Shellenberger essay would provide some meaty criticism that would make the substance of Kunstler & Diamond’s books clearer, but the sad fact is that most of the essay is cheap insults, flaky logic, and sensationalist accusations. One moment they’re trying to discredit Diamond’s book by claiming that today’s ecological crises are better understood by “research into political psychology and social values” than by his studies, the next they’re throwing around phrases like “biblical rather than scientific” to get us to dismiss others’ analysis. The middle of the essay would fit right into a middling Relativist Philosophy 101 paper. I will grant them that including some half-hearted questioning of human-caused climate change was a little unexpected. Thanks to Salon for publishing this excerpt — I would have hated to waste the library’s time by checking a copy out.

As for Kunstler and Diamond’s books, I’d recommend them both. Kunstler certainly lives on the gloomy side of things, but his perspective is important to take into consideration. I hope things don’t turn out like he suggests, but I don’t see any reason why they couldn’t. His histories of the 20th century as a whole, and American politics of the last few decades through the prism of oil availability, are both fresh perspectives. It’s also hard to argue that a finite supply of fossil fuel, steadily increasing demand, lack of proven alternatives, and drastic implications for significant energy price increases demand serious planning.

Diamond’s survey of cultures is more hopeful, as it includes examples where people have succeeded in adopting to limits on available resources, as well as where they have not. Implications for the intensely interconnected societies we live in now aren’t clear, but there are surely some relevant lessons to be found.

Nordhaus and Shellenberger seem to think the key to our society’s survival is smiling and thinking happy thoughts, but if they can’t do that while honesty dealing with their critics, they’ll get no support from me. Anyone interested in further, better informed criticism of Nordhaus & Shellenberger’s recent work might want to check out this, this or this — none of which was presumably written over the authors’ lunch break.

Sorry, but vinyl rugs are not cool

Tuesday, December 11th, 2007

I’ve been reading Kevin Kelly’s Cool Tools blog for a while, and it generally lives up to its name. Today’s entry, however, was a bummer — it promotes vinyl rugs. Vinyl has some seriously nasty health and environmental issues which more than offset any convenience it may offer for pets with leaky bladders.

Fortunately, there are better alternatives.