Accueil > professional > Why this fuss about scriptlets and taglibs ?

Why this fuss about scriptlets and taglibs ?

[Cet article est également disponible en Français.]

We all know blog entries and articles like « XYZ is the best » and « how to choose a web framework ».

One thing which often stroke me is the seemingly importance of « good tag lib support » and other scriptlets. Let’s be clear: there can’t be a good tag lib/scriptlet language. Some can be well coded, but still: it’s a broken idea from the start. And saying « putting business logic in the scriptlet is a BAD practice », like the Grails doc does, doesn’t help.

Why such an harsh opinion ?
Well…

Yet another language to learn.
Yes I know, we should all learn one new language every morning. But I would prefer them to add new stuff, new concepts. Here it’s the same all over again, with just syntax changes. Don’t expect any surprise, but bad ones. Like no one knowing how to use the XYZ tag of some library whose documentation has never been seen. Oh, by the way, you can most probably forget javadoc and the like, especially inside the code.

Scriplets and tag lib aren’t object oriented.
Forget about Object Oriented programming. Declaring classes and interfaces is hardly possible, even less used. It’s even worse regarding inheritance. What should it matter ? Well, try cobol and come back, thanks 😉 Seriously, forget design patterns and the like. It’s the land of procedural programming, not OO, so much for all it brings!

Even the best IDE support is… crappy.
Well, one of the best I had to work with was Visual Studio and ASP.Net. What you get there is basically auto completion. Already way better than nothing, but what about all these nice navigations helpers like « show class hierarchy », « show references », « open call hierarchy » and the others ? Furthermore, if you wrote some scriptlet, what about « extract method », renaming and other refactoring tools ? Forget them, you’re doing tag libs and scriplets, stone age is your lot. Not to forget, for sure, that if ever such tools exists, do the tools understand the cross cutting impacts between your backing programming language and the scriplets ? Anayway, despite the age of scriptlets and taglibs, such tools haven’t seen the light up to now…

It’s messy like hell !
Where do you put your scriplets ? In some html page. What’s in there already ? Easy: html tags, texts, css and most probably javascript. And then you should add, on top, your little scriptlets and tags. Splendid! The odds are high the designer won’t be able to get it at all, neither the next developer using it… Such a nice way to communicate your intent in your code, brrr…

Business logic may well sneak into your page.
We all know it’s a bad practice. Business logic should be in some business layer. Without duplication around. Cleanly put and easy to find/change. But, « hey, com’on, I’m just skipping the items whose parents contains the Foo element, we never want them anyway ». And even if you stick to this line, despite willingness to go fast and the danger of inattention, what about the next developer? And how to check that none broke the rule ? Remember this nice « non IDE support » you get ? Well, I guess you’ve to painfully read these nice pieces of code one by one. It sounds quite like some hell punishment… I wish it to none!

In the end, to me, scriplets and tag libs really feel like a false good idea we should thrive to forget. They’re cumbersome to develop, hard to customize (tags) and generalize (scriptlets), messy and a real pain to maintain. Any web framework which features such functionalities makes me shiver. Specific tags or hooks for the backing programming language, yes, for sure. But as soon as « if », « while » and their friends come in, I’m off. And I’m pretty sure we should all be off by then !

++
joseph

Publicités
Étiquettes : , , , ,
  1. Aucun commentaire pour l’instant.
  1. janvier 8, 2011 à 10:26

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s

%d blogueurs aiment cette page :