Apache Cocoon Review

27 01 2005

Apache Cocoon Logo

Apache Cocoon is a web development framework built around the concepts of separation of concerns (making sure people can interact and collaborate on a project, without stepping on each other toes) and component-based web development.

Cocoon implements these concepts around the notion of “component pipelines”, each component on the pipeline specializing on a particular operation. This makes it possible to use a “building block” approach for web solutions, hooking together components into pipelines without any required programming.

Cocoon is “web glue for your web application development needs”. It is a glue that keeps concerns separate and allows parallel evolution of the two sides, improving development pace and reducing the chance of conflicts.

The website explains quite nicely what you can expect from Cocoon,doesn't it? The problem is that, on the other hand, it does a lousy job of explaining in clear and comprehensive terms how you are expected to work in order to reap all those benefits.

As we all know, great documentation is not a selling point of many Open Source projects, and Cocoon is not different in this respect. Add to it the fact that it is a complex, evolving framework that sometimes gives you too many options when you have to implement something, and you'll begin to understand why the docs, to put it bluntly, largely suck.

Alas, all is not lost. You have a users' mailing list for you beginner's questions and a developers' mailing list where you can discuss Cocoon internals and more esoteric issues. You can expect to find a quick and detailed response on either. Even beginner-level requests for support are not shunned on the dev list, as is the case with some other projects I know of.

Other valuable resources are books (a bit outdated though) and articles that you can find online.

Also, if your pockets are deep enough, you can hire very good consultants to hold your hand while you're dipping your toes in the water for the first time.

To sum it up, don't be put off if at first you're having some difficulties. With a good knowledge of Java and XML, and maybe some external help, you can surpass them quickly.

Well, enough about lack of docs and on to the good stuff.

I started using Cocoon back in the days of version 1.7 (1999 circa) and never stopped. I have developed maybe twenty projects with it and done my small share of contributions, in the spirit of Open Source, that gained me committer status back in 2003, of which I'm very proud.

There are lots of gems in Cocoon, but I would like to draw your attention to a couple of them, in particular: Forms and Flowscript.

The Cocoon Forms framework is one of the more elegant toolkits for doing web-based forms that you can find. It embodies perfectly the Separation of Concerns philosophy of Cocoon, allowing one to separately define form model, definition and appearance.

Continuations-based Flowscript is something that will really revolutionize the way you develop web applications. Without it, implementing complex control flows for the web is a daunting task, forcing you to implement finite state machines and tricks like hidden form fields in order to overcome the inherent statelessness of HTTP. I cannot explain the concept of continuations in this review, but I can assure you that once you get the hang of it, you will never ever want to come back. For an in-depth look, I can refer you to a recent article on developerWorks.

The other great thing about Cocoon is not in the code. It's the community. You won't easily find a community of developers that is like Cocoon's. The best way to appreciate it is to participate in the annual GetTogether event.

Now for some less enthusiastic notes. What I like less about Cocoon is the fact that it's based on the Apache Avalon framework. Avalon was one of the first examples of a framework based on Inversion of Control, and was great for its time, but nowadays it looks quite dated if you compare it to something more modern and less invasive, like Spring or Hivemind.

Should you be worried about this? Not at all. First, you're not supposed to be an Avalon expert to use Cocoon. You can develop a wide range of applications without ever implementing a custom Avalon component. Personally, I like to develop applications by implementing all my business logic with Spring and persistence with Hibernate, using Cocoon's Flowscript to take care of, roughly, the controller part of the MVC triad, and Cocoon's generators, transformers and serializers to implement the view part.

In conclusion, I cannot give Cocoon less than five stars, given how much it has helped me in the latest years. It has its shortcomings, but who hasn't, and you can see them as part of its overall philosophy. There's a Cocoon Way of doing things, and you can bend it, but to a point.

Highly recommended.




4 responses

10 06 2005

Ok, I like the non techical review; moreover
if you can provide performance details on “High” volumn, “High” transaction sites;
300K+ per hour. I’m not sure Cocoon is the right fit. Also any comments on manageability?
Best regards

10 06 2005

http://vnunet.com runs on Cocoon and serves a comparable number of pages. You can read here http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=108524867813870&w=2 for the details.

Also here http://wiki.apache.org/cocoon/CocoonPerformanceResults?highlight=%28performance%29 are some benchmarks.

11 04 2006

my wish is to learn very good cocoon, but my problem is: i can not find anywhere a good start of cocoon with eclipse for example!
i mean, find a good tutorial!
Would you like to tell me where i can find it.
I’ve been searching it one week!
many thanks
bestes regards

6 12 2006
Agylen » Why Jotspot?

[…] Second, my time is limited and I very much value having an hosted service that is ready to use. This is why I simply started by writing a review on this blog. I don’t want to start a new software development project and be dragged down by bike-shed type of arguments. […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: