From: Keats <ke...@su...> - 2003-07-23 23:08:19
|
It seems to me that a LazyVariableFactory is just another name for a ContextTool. Yes there are more improvements that can be made to the ContextTool mechanism. Decoupling it from the config is a good idea. Making it work with generic classes is also a step forward. In fact I've implemented something like this, but noone seemed interested at the time. Basically I built some adapters that take various kinds of classes (static, singleton, factory, normal) and load them as context tools on demand. I can probably dredge up this old code if anyone is interested. Keats -------Original Message------- From: Marc Palmer <ma...@an...> Sent: 07/23/03 06:37 PM To: web...@li... Subject: Re: [Webmacro-devel] Voting on the ContextTool issue? > > On Wed, 23 Jul 2003 12:07:00 -0700, Brian Goetz <br...@qu...> wrote: > There's not a single thing in Marc's e-mail that I agree with. Where > to start? You surprise me Brian! Actually I can't remember a time when you ever agreed with me :) >> > I'm all for more discussion, or concrete proposals. I think most of >> > the suggestions made so far need to be thought through and fleshed out >> > more before "voting". >> >> I mean vote on the idea of the changes, not the details. > > That's not a vote. Er, ok. I thought we had to be aligned in our decisions about what will happen, as well as how those things will happen. >> > Then make your case, compellingly! > > (arguments elided) > > What you've done here is made several arguments why, if you were > redesigning WM from scratch, why you would not have context tools. I > don't dispute this conclusion. However, that's not the same thing. > You don't like them. People don't use them exactly the way Justin had > in mind. They're aesthetically displeasing. These may all be true, > but none of these are arguments for getting rid of them. > > Is there something so fundamentally broken about them that they > prevent other valuable improvements from being made? That is the kind > of case you'd have to make to make it worthwhile screwing all the > users who use them now. > > If you want to make an argument for deprecating the mechanism and > providing new, better mechanisms for doing the same thing, fine. Make > that argument, but that's not what you've suggested. OK. We rewrite it. Add a LazyVariableFactory mechanism, with a default impl that looks and smells like ContextTools but is completely optional. The factory has a method: Object getVariable(String name, Context c) Then we expose a get/setLazyVariableFactory method in Broker so that applications can set this at app init time, independent of WM config. This way applications can completely control their environment and keep things clean. >> That is not an issue IMO, as we have agreed that WM 2.0 will hose >> backward compatibility anyway with all the package refactoring. > > So many fallacies here I can't count. I'll address the major ones: > > 1. A package refactor should have minimal effect on WM users. It most likely will stop most of their code compiling. Existing changes already break most WM code - i.e. the hiding of FastWriter. Anybody who does not rely on WMServlet will have broken code with WM 2.0 - and rightly so of course. > 2. If it does have an effect on some users, they will be the most > advanced users of WM (those that write their own directives and tools), > which minimizes the pain. As above, I disagree with this. Only those who use WMServlet exclusively will escape pain free. I'm not saying the pain is significant, it isn't. I've done it. Ignition is running against the bleeding-edge build of WM. > 3. Just because you're going to break something is not an argument > for breaking everything! That's kind of like saying "I already spilled > wine on the carpet, so I'm sure you won't mind me burning down the > house." Well it depends on whether your house insurance policy covers accidental damage to carpets and how expensive the carpet was ;-) That's not what I was saying though, and you know that. I was just saying that other stuff is broken too, so we shouldn't worry unnecessarily about a few other bits, as long as it is not too painless. For example, we could remove CTs completely and provide a ContextToolLoader utility class in WM 2.0 that provides the old functionality but without lazy instantiation - if you don't like my LazyVariableFactory idea (and something tells me you won't): Template t = getTemplate(templatename); Context c = wm.getContext(); ContextToolLoader ctl = new ContextToolLoader(wm.getBroker()); // reads from WM settings ctl.stuff(c); There, 2 lines of code and those poor people in broken code land will be on a one way ticket to nirvana. Incidentally this is just an example. I prefer the LazyVariableFactory concept myself. >> Again, I think you have misunderstood. Vote on direction, not >> details. Unless we declare a vote on the subject we are unlikely to >> get the full discussion we so desire. > > I think that's a side-effect of rushing the process. I don't feel > like this subject is remotely ripe enough for a vote. These things > are supposed to take a long time. OK, but if I hadn't asked for a vote we wouldn't have had all these ideas coming out now :) > I think that while Context tools may have outlive their usefulness, > they are also (at this point) pretty unobtrusive in WM. I think there > are more useful things we could do to make WM easier to use / maintain > than removing features which are widely used but which we find > aesthetically displeasing. I know we removed a lot of things > recently, but all of those are things that we are confident few users > use. This is different. Solution: LazyVariableFactory! Get the best of both worlds :) With this solution, apps like Ignition could handle lazy instantiation of their sometimes expensive helpers with ease. Marc -- Marc Palmer Contract Java Consultant/Developer w a n g j a m m e r s java and web software design experts with an ethical outlook http://www.wangjammers.org ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Webmacro-devel mailing list Web...@li... https://lists.sourceforge.net/lists/listinfo/webmacro-devel > |
From: Marc P. <ma...@an...> - 2003-07-23 23:34:02
|
On Wed, 23 Jul 2003 19:08:08 -0400 (GMT), Keats <ke...@su...> wrote: > It seems to me that a LazyVariableFactory is just another name for a > ContextTool. That's not what I proposed it for. > Yes there are more improvements that can be made to the ContextTool > mechanism. Decoupling it from the config is a good idea. That's what I mean for LazyVariableFactory. It is the impl in WM that knows that it has to look up tools and create them. i.e. we remove all the CT config stuff from WM "core" code, and stuff it into a LazyVariableFactory impl. Then in WebMacro.properties (for example): LazyVariableFactory: org.webmacro.legacy.ContextToolFactory This would reproduce the current behaviour of WM - reading the settings from Broker to find all the ContextToolXXXX properties and caching the info, and then when (if) asked it can create any of them on demand to be put into a context. Thus the code in Context becomes (pseudo): if (context.get(varname) == null) { if (broker.getLazyVariableFactory() != null) return broker.getLazyVariableFactory().getVariable( varname, this); } ...and there is no other CT logic in WM core code (Context or Broker). That's it. We just abstract the whole mechanism, and Eric and I will have no "LazyVariableFactory:" entry in WebMacro.properties :) See what I'm getting at? > Making it work with generic classes is also a step forward. In fact I've > implemented something like this, but noone seemed interested at the time. > Basically I built some adapters that take various kinds of classes > (static, singleton, factory, normal) and load them as context tools on > demand. I can probably dredge up this old code if anyone is interested. This is only necessary if the context-aware initialization thing is retained as is. Here's what I now propose, hopefully somewhat clearer: 1. Remove all CT logic from Context/Broker etc 2. Deprecate CT interface 3. Make the CT interface empty, instead extending a new core interface ContextAware with the same init(context) method currently in CT. This retains compatibility with current CTs while deprecating the interface itself, and gains us further abstraction in ContextAware. 4. We add an interface equivalent to LazyVariableFactory, with one method getVariable( name, context). 5. We add simple logic (as shown earlier) to make Context/Broker do the work of looking for the single instance of this factory if available, thus replacing the current CT instantiation logic 6. We put most of the excised CT login into an impl of LazyVariableFactory called ContextToolFactory and put this in some package like o.w.legacy or o.w.util. 7. We add code to the new Context/Broker logic so that after asking the LazyVariableFactory for a variable instance and getting one succesfully we do: if (newvar instanceof ContextAware) ((ContextAware)newvar).init( this); 8. We remove all context tool settings from WebMacro.defaults and put it in the shipped WebMacro.properties 9. We put "LazyVariableFactory: org.webmacro.legacy.ContextToolFactory" into WebMacro.properties. 10. Add get/setLazyVariableFactory(Class) to Broker/wherever so apps can supply custom handling. What this gets us: a) Removes CT from core WM concepts = cleaner WM focussing on template rendering not "data management" b) Retains CT compatibility for you old-fashioned types c) Brings us new context-aware vars - which context.put() could also check for, even though Brian says this is a waste of CPU - despite also pointing out that instanceof is pretty damn cheap these days, and we are typically talking maybe 5-10 puts per template. d) Gives applications the ability to completely control template variables. i.e. I may want to ship WM without modification but not allow templates access to $Request or $Response and instead have my own special vars for doing something similar. I expect this to be greeted with the usual disagreement :) -- Marc Palmer Contract Java Consultant/Developer w a n g j a m m e r s java and web software design experts with an ethical outlook http://www.wangjammers.org |
From: Brian G. <br...@qu...> - 2003-07-23 23:50:49
|
>...and there is no other CT logic in WM core code (Context or Broker). >That's it. We just abstract the whole mechanism, and Eric and I will have >no "LazyVariableFactory:" entry in WebMacro.properties :) > >See what I'm getting at? It sounds like what you're getting at is: you don't like having context tools in the WM defaults. Why? At this point, it adds no performance overhead, nor does it have variable capture problems, nor does it complicate WM development or maintenance. So is the objection entirely aesthetic? If so, that is not remotely grounds for removing a facility that people use. Still, the lazy thing sounds useful -- keep talking about its merits and stop talking about ripping out context tool support and you might convince me. -- Brian Goetz Quiotix Corporation br...@qu... Tel: 650-843-1300 Fax: 650-324-8032 http://www.quiotix.com |
From: Lane S. <la...@op...> - 2003-07-24 06:08:17
|
Marc Palmer wrote: > On Wed, 23 Jul 2003 19:08:08 -0400 (GMT), Keats <ke...@su...> > wrote: > > > I expect this to be greeted with the usual disagreement :) actually it is a pretty good plan because it does provide the best of both wolds. -lane > > |
From: Brian G. <br...@qu...> - 2003-07-23 23:56:36
|
>a) Removes CT from core WM concepts = cleaner WM focussing on template >rendering not "data management" You've STILL not made a compelling argument as to why context tools are a problem for WM. Why do they bother you so much, that you are willing to condemn existing WM users to change their templates and/or configuration, just to get rid of them? >b) Retains CT compatibility for you old-fashioned types Not quite. That would only be true of you put the line LazyVariableFactory: org.webmacro.legacy.ContextToolFactory in WM.defaults. But I suspect this suggestion runs counter to the real point of your proposal. -- Brian Goetz Quiotix Corporation br...@qu... Tel: 650-843-1300 Fax: 650-324-8032 http://www.quiotix.com |
From: Marc P. <ma...@an...> - 2003-07-24 00:06:38
|
On Wed, 23 Jul 2003 16:52:14 -0700, Brian Goetz <br...@qu...> wrote: > >> a) Removes CT from core WM concepts = cleaner WM focussing on template >> rendering not "data management" > > You've STILL not made a compelling argument as to why context tools are a > problem for WM. Why do they bother you so much, that you are willing to > condemn existing WM users to change their templates and/or configuration, > just to get rid of them? There have been so many issues raised relating to them - many of which I think can be pushed to the sidelines if we we do this refactor. >> b) Retains CT compatibility for you old-fashioned types > > Not quite. That would only be true of you put the line > > LazyVariableFactory: org.webmacro.legacy.ContextToolFactory > > in WM.defaults. But I suspect this suggestion runs counter to the real > point of your proposal. Well I wouldn't mind if we had a way to nicely "mute" settings in WM.defaults. Actually I think we do don't we? LazyVariableFactory: Would do it wouldn't it, or worst case we could force it to use a null impl if we want to ditch ContextTools. That solves the issue of the position of the factory (in WM.defaults instead, thus not breaking anything) but it still leaves us with the problem of not being able to reliably suppress certain CTs by wiping them out in WebMacro.properties to override their definition in WebMacro.defaults. This is because we can't rely on knowing all the CTs that are defined in WM.defaults for any version X.Y of WM. That's one reason why I don't like it - overriding stuff in properties objects is an inexact science. See the problem? Taking a shrink-wrapped WM jar how can my app reliably suppress all CTs except $Form, for example? I don't think it's possibly without me tracking what CTs are in any one WM release and explicitly suppressing them in WM.properties. In this case however, my best option is to use LazyVariableFactory to wipe out the CT factory and it all goes. I'm just mentioning this to highlight some of the problems with having CTs in WM.defaults. Marc -- Marc Palmer Contract Java Consultant/Developer w a n g j a m m e r s java and web software design experts with an ethical outlook http://www.wangjammers.org |
From: Brian G. <br...@qu...> - 2003-07-24 00:20:01
|
>Well I wouldn't mind if we had a way to nicely "mute" settings in >WM.defaults. Actually I think we do don't we? > >LazyVariableFactory: I did something like that to let you remove directives and tools from the list, but I'm not sure if it works for arbitrary tags -- but it certainly could. >See the problem? Taking a shrink-wrapped WM jar how can my app reliably >suppress all CTs except $Form, for example? I don't think it's possibly >without me tracking what CTs are in any one WM release and explicitly >suppressing them in WM.properties. But why do you need to suppress individual CTs at all? They don't have any per-request overhead. And they don't have variable name capture problems. So what's the problem? If you don't use them, they don't cost you anything. No problem. -- Brian Goetz Quiotix Corporation br...@qu... Tel: 650-843-1300 Fax: 650-324-8032 http://www.quiotix.com |
From: Eric B. R. <eb...@tc...> - 2003-07-24 00:24:19
|
On Wednesday, July 23, 2003, at 08:10 PM, Brian Goetz wrote: > But why do you need to suppress individual CTs at all? They don't > have any per-request overhead. And they don't have variable name > capture problems. So what's the problem? If you don't use them, they > don't cost you anything. No problem. Until a template designer decides to start using it... w/o your knowledge or permission. I don't think Marc is arguing performance here. He's arguing against WM doing magical things that you have little control over. eric > > > > -- > Brian Goetz > Quiotix Corporation > br...@qu... Tel: 650-843-1300 Fax: > 650-324-8032 > > http://www.quiotix.com > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/ > direct;at.aspnet_072303_01/01 > _______________________________________________ > Webmacro-devel mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webmacro-devel |
From: Marc P. <ma...@an...> - 2003-07-24 10:24:59
|
On Wed, 23 Jul 2003 20:24:09 -0400, Eric B. Ridge <eb...@tc...> wrote: > On Wednesday, July 23, 2003, at 08:10 PM, Brian Goetz wrote: > >> But why do you need to suppress individual CTs at all? They don't have >> any per-request overhead. And they don't have variable name capture >> problems. So what's the problem? If you don't use them, they don't >> cost you anything. No problem. > > Until a template designer decides to start using it... w/o your > knowledge or permission. I don't think Marc is arguing performance > here. He's arguing against WM doing magical things that you have little > control over. Yippeee! Right on the money! -- Marc Palmer Contract Java Consultant/Developer w a n g j a m m e r s java and web software design experts with an ethical outlook http://www.wangjammers.org |
From: Marc P. <ma...@an...> - 2003-07-24 10:01:59
|
On Wed, 23 Jul 2003 17:10:38 -0700, Brian Goetz <br...@qu...> wrote: > >> Well I wouldn't mind if we had a way to nicely "mute" settings in >> WM.defaults. Actually I think we do don't we? >> >> LazyVariableFactory: > > I did something like that to let you remove directives and tools from the > list, but I'm not sure if it works for arbitrary tags -- but it certainly > could. > >> See the problem? Taking a shrink-wrapped WM jar how can my app reliably >> suppress all CTs except $Form, for example? I don't think it's possibly >> without me tracking what CTs are in any one WM release and explicitly >> suppressing them in WM.properties. > > But why do you need to suppress individual CTs at all? They don't have > any per-request overhead. And they don't have variable name capture > problems. So what's the problem? If you don't use them, they don't cost > you anything. No problem. Actually there is a problem, but I obviously haven't elucidated it clearly. Currently we view WM as a "system" or whatever you want to call it, but we definitely see it as more than just a "template rendering library". Call it a mini-framework if you will, because there are so many legacy add-ons that take it beyond mere load template/populate context/render to output. This has, at times, been a valid complaint against WM (vis Velocity). We are so used to WM that it is hard to step back and see what it really looks like to outsiders. Now, with specific reference to the CT issue. Imagine we are new to WM. We want to write a whizz-bang web framework that uses WM for templating, and we have all these new high-level ideas for a new paradigm of access to request/response/form fields that will prevent people screwing things up, bypassing our request parameter naming conventions etc. Then we read the WM docs and find that all these ContextTools exist. However we want our app to provide a completely different paradigm for accessing these resources, so we want don't want all the existing CTs in there because it could confuse our users if they read somewhere else about these features of WM, and worse it could have them bypassing important mechanisms of our application. Besides, if our app hasn't put them there and they aren't part of our app design, why should they remain? It's not the mythical overhead of them we are concerned about, it's the fact that the user could start using them and we have no control over it. I'm trying to think of an analogy that works - ah this might. Imagine if we were talking about writing a framework that used XSLT instead, but we discovered that XSLT provides a whole bunch of template rules by default (apart from the default handler) and we can't effectively prevent them being used, even if they were completely irrelevant or perhaps problematic for our application. It would suck! Marc -- Marc Palmer Contract Java Consultant/Developer w a n g j a m m e r s java and web software design experts with an ethical outlook http://www.wangjammers.org |
From: Brian G. <br...@qu...> - 2003-07-24 21:21:27
|
>Actually there is a problem, but I obviously haven't elucidated it clearly. OK, between Eric and Marc, I now see what they're talking about. I don't think the problem is with context tools -- I think the problem is that we are basically schizoid about whether WM is a framework or a rendering engine, and what degree of framework and application support it has. Basically, what you want to be able to do is have one party (say, the architect) configure WM, embed it in the application or framework, and publish the WM service to another party (the developers/designers) and have some control over what directives, facilities, macros, policies, etc are available for the developers/designers to use. In other words, its OK to have "magic" stuff, but you want the magic to be put there by the application architect, not by WM. So what you want is a mechanism for adding your own magic. A more formal plug-in concept comes to mind, for directives, macros, tools, etc. Is this what you're talking about? -- Brian Goetz Quiotix Corporation br...@qu... Tel: 650-843-1300 Fax: 650-324-8032 http://www.quiotix.com |
From: Eric B. R. <eb...@tc...> - 2003-07-24 21:35:36
|
On Thursday, July 24, 2003, at 05:20 PM, Brian Goetz wrote: > In other words, its OK to have "magic" stuff, but you want the magic > to be put there by the application architect, not by WM. So what you > want is a mechanism for adding your own magic. No, want the ability for *removing* the things that are magically placed in the context. If this translates to "a more formal plug-in concept", that's fine, but the idea is to eliminate magical stuff, not make it easier to introduce more. eric |
From: Brian G. <br...@qu...> - 2003-07-24 21:39:18
|
>>In other words, its OK to have "magic" stuff, but you want the magic to >>be put there by the application architect, not by WM. So what you want >>is a mechanism for adding your own magic. > >No, want the ability for *removing* the things that are magically placed >in the context. If this translates to "a more formal plug-in concept", >that's fine, but the idea is to eliminate magical stuff, not make it >easier to introduce more. I wasn't clear. I meant that you want _all_ the magic under the "applications" control. My concern is that this is basically assuming one kind of application model. I think enumerating the use cases first would shed a lot of light on the issue. -- Brian Goetz Quiotix Corporation br...@qu... Tel: 650-843-1300 Fax: 650-324-8032 http://www.quiotix.com |
From: Eric B. R. <eb...@tc...> - 2003-07-24 22:12:28
|
On Thursday, July 24, 2003, at 05:38 PM, Brian Goetz wrote: >>> In other words, its OK to have "magic" stuff, but you want the magic >>> to be put there by the application architect, not by WM. So what >>> you want is a mechanism for adding your own magic. >> >> No, want the ability for *removing* the things that are magically >> placed in the context. If this translates to "a more formal plug-in >> concept", that's fine, but the idea is to eliminate magical stuff, >> not make it easier to introduce more. > > I wasn't clear. I meant that you want _all_ the magic under the > "applications" control. No, I want all the magic to go away. > My concern is that this is basically assuming one kind of application > model. I think enumerating the use cases first would shed a lot of > light on the issue. There are no use cases worth mentioning for context tools (other than the case of them already being in use by our users). eric |
From: Brian G. <br...@qu...> - 2003-07-24 22:14:51
|
>There are no use cases worth mentioning for context tools (other than the >case of them already being in use by our users). That's not what I meant by use cases. I meant the different ways WM might be used (servlet application, etc.) -- Brian Goetz Quiotix Corporation br...@qu... Tel: 650-843-1300 Fax: 650-324-8032 http://www.quiotix.com |
From: Brian G. <br...@qu...> - 2003-07-24 22:26:22
|
>>I wasn't clear. I meant that you want _all_ the magic under the >>"applications" control. > >No, I want all the magic to go away. I actually think the magic is pretty important! I guess we're going to have to talk about this. -- Brian Goetz Quiotix Corporation br...@qu... Tel: 650-843-1300 Fax: 650-324-8032 http://www.quiotix.com |
From: Eric B. R. <eb...@tc...> - 2003-07-24 22:34:38
|
On Thursday, July 24, 2003, at 06:26 PM, Brian Goetz wrote: >>> I wasn't clear. I meant that you want _all_ the magic under the >>> "applications" control. >> >> No, I want all the magic to go away. > > I actually think the magic is pretty important! Other than to support users that are already under our spell, what makes this magic important? Seriously, I can think of nothing... and I'm not even trying to be stubborn. eric |
From: <web...@st...> - 2003-07-29 07:58:49
|
On Thu, 24 Jul 2003, Brian Goetz wrote: | | >>In other words, its OK to have "magic" stuff, but you want the magic to | >>be put there by the application architect, not by WM. So what you want | >>is a mechanism for adding your own magic. | > | >No, want the ability for *removing* the things that are magically placed | >in the context. If this translates to "a more formal plug-in concept", | >that's fine, but the idea is to eliminate magical stuff, not make it | >easier to introduce more. | | I wasn't clear. I meant that you want _all_ the magic under the | "applications" control. | | My concern is that this is basically assuming one kind of application | model. I think enumerating the use cases first would shed a lot of light | on the issue. Well.. I have a Portal-Portlet type framework. I actually use Context instead of WebContext to get rid of all the web-type stuff, as giving such stuff to the Portlet ("Corelet") writer would destroy my entire logic. So I'm totally for removing -every one- of these tools. But why not just make it optional? So that you'd have to configure or, even better, programatically add them yourself? I want the (default) WebMacros out, I want the (default) ContextTools out, I want the (default) global functions out, I want the stupid hang-around idiotic Threads out - and -everything- that isn't directly related to WebMacro being a Template engine, OUT. I want a TEMPLATE ENGINE! WebMacro should take a Context - merge it with a Template - and nothing else. I could add nifty stuff to the template-writer's universe myself, provided that the functionality (CTs and GFs) are in the engine. Just remove the default junk. Endre. |
From: Brian G. <br...@qu...> - 2003-07-29 08:34:11
|
> I want the (default) WebMacros out, I want the (default) ContextTools out, > I want the (default) global functions out, I want the stupid hang-around > idiotic Threads out - and -everything- that isn't directly related to > WebMacro being a Template engine, OUT. The thread is out. |