I have been looking through a lot of code lately, looking for inspiration, and I am noticing something: practically every ColdFusion custom tag that I see is highly coupled to the parent application. I don't use custom tags all that often, so I have no great experience to feed off of here, but shouldn't all data required by a ColdFusion custom tag be passed in as an attribute of the tag?
I am looking at one custom tag right now from the CF Pet Market site application demos that uses:
- ATTRIBUTES-scoped variables
- APPLICATION-scoped variables
- REQUEST-scoped variables
- VARIABLES-scoped variables
Doesn't this seem a bit odd? Why the mixing and matching of all these scopes? Well, that's a poor question; the WHY is simply that it's easy this way. I guess the real question that I am driving at (and one that I would be very interested in getting answered) is "SHOULD" a custom tag use all these scopes? Doesn't this high degree of coupling to the parent application increase the maintenance costs and all that jazz? What are the best practices for ColdFusion custom tags?
I am not attacking about this - I really am interested as I am trying to figure out how I want to tackle a particular problem. I am also curious to see how people relate ColdFusion custom tags to ColdFusion components. People are all heated now about dependency injection and passing in data, low coupling and high cohesion and all that when it comes to ColdFusion components. Why such a huge change in standards for ColdFusion custom tags?