No More Cocoon For Me

Well, I've spent the last week or so working with Cocoon and I give up. I can't get any real work done with it, so I'm moving on. This isn't an attack on Cocoon but the whole idea was that it was supposed to help my productivity, not make me insane. Part of the problem is XML, of course, which is relatively picky and XSL is another pain in the ass, but I was sort of expecting that. Cocoon, however, adds its own peculiarities and wraps all of these things up into a big black box which hides waaay too much stuff from me. After a week of dealing with it, I'm going back to basics.

I OBVIOUSLY just don't know how to use Cocoon properly, but the fact is that after absorbing two big-ass books and spending a hell of a lot of time on it, if I'm not getting any work done, then it's not the right technology for me. Cocoon generally goes against my way of thinking about things anyways. To me all this stuff we spend so much time doing is very, very simple: There's data in the database. You need to grab it and show it to someone so they can do something with it. They read, they write, they delete. That's it. The more crap you put between you and the database is just bad... for each layer, there better be a damn good reason for it.

Actually, I swear, I'm an inch away from scrapping all this Java crap on the server and using Python. I mean it. If no one's paying me for this then life's too freakin' short. I've been meaning to pick Python up for a while now - it seems like such a more productive tool than Java. Especially since I rarely get past the prototype stage in the first place, I really should use the right tool for the right job.

Honestly, I really like Cocoon's philosphy a lot. I LOVE the pipeline - especially the mappings. I wish there was a Java server-side bit out there just for that piece because it's so freakin' useful. In fact, I'd say that JSP should work like that right out of the box - the URL and the processing that responds to it should have NOTHING to do with each other in a dynamic application. I should be able to map an arbitrary URL to any JSP or servlet I want without having to resort to hacks and custom written code like I have on this server code now. Right now I just pass the request to the appropriate JSP page, which may or may not respond. Cocoon's pipeline is so much more detailed and clear (unlike Strut's actions) - you can define multiple processing points, and then at the end define one of a serializer to respond back to the user. It's incredibly intuitive (if you've been doing server-side dev for more than 3 minutes). However, beyond that, it gets REALLY complicated and I've found it difficult to be productive.

Urgh. Specifically, what I was doing was using this blog's data (all 3000+ posts and comments) as a sample test bed for Cocoon. I figured the first thing I would do is rework my weblog code as a Cocoon App so I could learn the ins and outs before delving into a brand new somewhat undefined project. Now, anyone who's seen the original MiniBlog code knows that it's just a big hack and the current version is only marginally better. It took me a day to write and probably several days over the past year to work out the issues. But that's about it. Using Cocoon, I should be able to grab the contents from the db, make it into XML and then transform it for the Web and for Mobile devices (or anything else I want to write an XSL transformation for) all in one big swoop. It should be simple - and I should've moved on by now. But instead I got caught playing entities and transformation games.

Basically, the markup that's in my DB is horribly hacked HTML. It's sort of like pseudo HTML it's so bad, and nothing like XHTML. So in the generator step, I first got the data out of the DB and into an XML format by using HTML Tidy, which does its best to well-form your document (works really, really well, actually). Then after it's well-formed XML, I go to transform it. But something is up and Cocoon didn't like some of the entities in the original document. First it was the � sign, then it was a random �, then it game me weird ass errors about using the original &quote; mark and more. I have no idea what the hell it's talking about. The generator produces valid XML which can be transformed on the command line, but when using Cocoon, it just freaks out. I give up messing with it.

Basically it's like this - I NEED to be able to be sure that whatever CRAP I have in my db is able to be presented to the user. I need to be able to filter and tweak it, without errors. I NEED to be able to do this without emailing the Cocoon Dev list every 5 minutes and waiting for an answer. I'm afraid that Cocoon is just this enormous Black Box with a learning curve like an upside down hockey stick, so it's time to move on. Besides... Right now I'm only targeting one platform - the 3650's XHTML browser, which I've found out is quite forgiving of bad XHTML code (I'll write about this in a bit). So if an extra � slips by, I'm not going to worry too much about it. What counts now is productivity, not having the cleanest XML that's ever been produced by man.

Urgh. Pure frustration right now, can you feel it?


< Previous         Next >