Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Yesterday me and a friend were talking about the overuse of custom taglibs!

We create taglibs for everything! We create taglibs in order to wrap jQuery UI elements (tabs, button, etc), and other plugins elements as well. We often wrap them together in a single component. We use taglibs in a point that we almost have no pure html within the body tag.

Our question is: is this a healthy habit??? Imagine two situations:

1) We hire an html designer and have the cost of a month for him to learn all this stuff.

2) We want to outsource the html development but no company would get our taglib library to learn, OR it become more expensive.

We love taglibs as its been a lovely shortcut for javascipt development as we write it only once. What would be the best practices in this sense, and what would you suggest? We are looking for a future-proof solution (or an argument that agrees with ours).

share|improve this question
3  
Those are 2 very good reasons to stop it now aren't they? – Rig Apr 4 '12 at 0:23
Yes, @Rig! Thats the reason for this Q, the alternatives for reusable UI components – Renato Gama Apr 4 '12 at 1:20
1  
@Renato Could you rephrase your question to specifically ask about alternatives for reusable UI components, instead of what you have (which to my mind answers itself)? – jcmeloni Apr 4 '12 at 11:22

1 Answer

One of your uses of taglibs is to encapsulate JavaScript. Is it possible to do this with just a JavaScript file? (or a JavaScript file and a div so the JavaScript file can write out any HTML it needs. or a JavaScript file and a few regular HTML fields.)

JavaScript is very powerful. It has objects which let you avoid polluting the global namespace.

And no, as noted in the comments writing taglibs for everything is taking it too far. It's like you wrote your own JSF type language without the benefits of standardization.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.