You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Bill Boland <bo...@attbi.com> on 2002/05/19 05:16:03 UTC

ToolLoader tool

Gabe,

I'm going through the velocity-tools to try and understand them and try
to eventually contribute some tools that are complementary to them or to
add new methods, etc. The ToolLoader tool that you mentioned (doc at
http://www.teamup.com/jakarta-velocity-tools/tools/docs/ToolLoader.html)
and a comment made by Geir led me to think of some enhancements for
this. I'm going to explore these, but I thought I'd pass along some
ideas as I think of them.

I liked the simplicity of Geir's example where he used ("$tool =
new(<whatever>);") is some other scripting environment. I was thinking
that...

    #set ( $newTool = $tool.load(<whatever>) )

might be a nicer syntax to use for loading tools. 
(Oops...I just looked at the latest code. It looks like it is using that
syntax now.)

The <whatever> part the where I think some interesting possibilities
could be considered. I'm a bit wary of allowing access to any bean in
the classpath to the page designer as it currently stands (but it's
great for development). I think something like this might be nice:

    #set ( $math = $tool.load( "math" ) )

    #set ( $math = $tool.load( "math", arg0 ) )

    #set ( $math = $tool.load( "math", arg0, arg1 ) )

    #set ( $math = $tool.load( "math", arg0, arg1, arg2 ) )

The arguments (arg0, arg1, etc.) will depend upon the constructor
arguments of the class mapped to that tool name. Sometimes one tool may
be dependent on another tool or a value from the context:

    #set ( $fmt = $tool.load( "format", $req.locale ) )

This might load a FormatTool that is initialized to the locale of the
HttpServletRequest with the VelocityServlet.

The first argument would be the name of the tool in the tool library
(toolbox). As I try to understand it, this is what you are also trying
to provide with the ToolboxManager in the Views sub project. There seems
to be some synergy between them. I'm still trying to figure it out so be
patient with me. :)

But assuming the ToolLoader tool was "informed" (by way of a constructor
argument) with where to look up the mapping of tool names to their
classes, then the tool name could be validated, class introspected and
tool instance constructed. A Map would be a generic way to do this
mapping allowing for additional utility classes to make this more
dynamic. Again, I think there's some synergy to the XMLToolboxManager
here. Is there an implementation of a utility class that loads a Map
from a Properties file or XML file and updates the contents if the file
changes or if it's told to look elsewhere? It would nice to add/remove
new tools to the system without restarting the application. It's an area
that I'm not familiar with but I know Velocity loads the libraries files
when they change if you want it to.

As for backward compatibility, the classname could be used instead of
the tool name, but the ToolLoader would "turn on" this capability when
constructed if it was desired. It would extend the tool by allowing the
same constructor arguments for the tool as well.

Additional ideas (still in gaseous form floating about my brain):

* Loading tools that do not have state and can be shared by different
threads (constructing only one instance).
* Loading tools from a pool so they can be checked out (or created),
reinitialized, and then automatically be checked back in after the
merge. I don't know how important this is to performance. (Are there any
Velocity performance metrics or comparisons or studies as to where any
issues are at?)
* ToolLoader method that would describe the tool and the methods that
may be invoked. (Actually this could be for any bean). Just a wrapper
around some reflection but it might be nice to have them be
self-documenting.

Anyway...I'll go play now. You were looking for some feedback and this
was the first chance I had to look a bit more closely.

bill



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Martin van den Bemt <ml...@mvdb.net>.
+1. 
On Sun, 2002-05-19 at 07:34, Jon Scott Stevens wrote:
> I honestly believe that tools should not be loaded within VTL. It isn't MVC.
> Velocity is the VIEW and you are confusing the MC by creating this.
> 
> The framework which handles the MC should be responsible for loading tools
> and making them available in the context (as well as controlling the scope
> of the tools).
> 
> But, I'm sure that none of you will listen to me. So do whatever you want.

As long as loading tools that way is disabled by default...

Mvgr,
Martin 

> 
> -jon
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Gabriel Sidler <si...@teamup.ch>.
Nathan Bubna wrote:

> Bill said:
> 
>>I just didn't feel that the "approved" tools (if any) should be
>>constructed until they are really used for a specific template and the
>>template designer should know them by a "common" name, not a class name.
>>"Lazy" construction of the tools just allows for improved performance
>>for templates that don't use any/all of them.
>>
> 
> "lazy" for the system maybe, but more work for the designer.   also, it'll
> perform worse or no better for tools that are frequently used.   if your
> tools are well-designed, the performance hit of pre-populating the context
> should be quite negligible.  so given that pre-population is better MVC, i
> much prefer to avoid encouraging in-template tool loading.   i think it
> _can_ be a useful development tool, but i don't think it ought to be a
> common practice.


Yes, that summarizes well our design intentions with jakarta-velocity-tools.

The encouraged approach is the use of the VelocityViewServlet (VVS) to handled
the loading of tools automatically:
- VVS is a standalone Velocity template renderer. It can be used in a similar
   fashion as the JSPServlet (in a Struts environment VVS can be easily added
   next to JSPServlet. An application can then mix JSP templates and Velocity
   templates at will -> not the encouraged use, but useful for a transition)
- Tools to be made available to templates can be configured in a XML-based
   configuration files. VVS automatically instantiates and initializes
   tools and adds them into the context.
- VVS support three scopes for tools: application, session, request. Tools
   with a scope of 'application' are instantiated once and reused for all
   template processing requests, tools with a scope of 'request' are
   instantiated anew for every request, etc. This ensures efficient handling
   of tools where possible.
- Furthermore, in the design of the tool loading mechanism we have forseen,
   but not implemeted yet, the possibility to pool and reuse instances of
   tools, thereby further improving performance.
- Conceptually, the handling of view tools in VVS is very similar to the
   handling of view tools in Turbine 2. At the same time, VVS is completely
   independent of Turbine. Actually, since Turbine already has good tool
   support, the construction of VVS was more driven by people using other
   frameworks.


I see the ToolLoader as complementary to the tool loading mechanism
of VVS and as the tool of choice for special cases. Its presence recognizes the
fact that application scenarios and development environments vary so much, that
no one solution suits all needs.
- ToolLoader is useful for situations where a tools need special initialization
   parameters (an automatic tool loading mechanism only works with
   tools with a known constructor signature).
- ToolLoader may be useful for tools that are used very infrequently.
- Giving the template designers some control over the view tools to be
   loaded can actually help in some circumstances to decouple the work on
   V and C of MVC.
- If it is a security concern, simply don't make the ToolLoader available to
   the template designers (in VVS all it would take is to remove it from
   the configured list of auto-loaded tools).
- Tools can be used without VVS, Turbine or any other framework that
   has support for auto-loading tools. In such a environment ToolLoader may be
   the only option to dynamically load tools. A Velocity Standard Tool Library
   should be useful in as many envrionments are possible. VVS and Turbine are
   just two of many options.



Gabe





--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Nathan Bubna <na...@esha.com>.
Bill said:
> I just didn't feel that the "approved" tools (if any) should be
> constructed until they are really used for a specific template and the
> template designer should know them by a "common" name, not a class name.
> "Lazy" construction of the tools just allows for improved performance
> for templates that don't use any/all of them.

"lazy" for the system maybe, but more work for the designer.   also, it'll
perform worse or no better for tools that are frequently used.   if your
tools are well-designed, the performance hit of pre-populating the context
should be quite negligible.  so given that pre-population is better MVC, i
much prefer to avoid encouraging in-template tool loading.   i think it
_can_ be a useful development tool, but i don't think it ought to be a
common practice.

[snip]
> There so much out here, that this may exist already and I just haven't
> come upon it yet. Having tools (and tools for tools) be flexible for the
> many various projects that exist in the world is a great challenge.
> Every one doesn't wear the same size or style of shoe and some go
> barefoot!

heh.  i'm barefoot right now.  i've never been a big fan of shoes.  :-)

still, while flexibility does serve variety well, the fact is that some
methods and patterns are better than others.  as such, i value extensibility
above prepackaged flexibility.  leave room for people do unorthodox things
if they really want, but don't encourage it or do it for them.

Nathan Bubna
nathan@esha.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: ToolLoader tool

Posted by Bill Boland <bo...@attbi.com>.
Ouch!

Anyway, I was just exploring the idea of having the existing ToolLoader
class be more restrictive yet flexible by having the framework restrict
the tools that one might request from it. I didn't mean to re-open up a
can of worms.

bill

(Now, where did I put MY shoes?)



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Warner Onstine <sw...@warneronstine.com>.
----- Original Message -----
From: "Nathan Bubna" <na...@esha.com>
To: "Velocity Developers List" <ve...@jakarta.apache.org>
Sent: Monday, May 20, 2002 8:31 AM
Subject: Re: ToolLoader tool


> Jon said:
> > What needs to be figured out is if you guys are going to re-invent
Turbine
> > or not. ;-)
>
> nah, i think i'll pass on that.  you Turbine developers seem to do that
> enough.   how many active versions are being worked on out there right
now?
> ;-)
>
> seriously though, it's a good point.  we do need to watch that this
> vel-tools stuff is built to work with frameworks, not be one.  and i think
> we're doing alright with that so far.

I definitely don't want to do this, what I want are easily deployable
components that I can use in Turbine, others I'm sure want to use it outside
of Turbine. If we can find a happy medium, great!

-warner

> Nathan Bubna
> nathan@esha.com
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Nathan Bubna <na...@esha.com>.
Jon said:
> What needs to be figured out is if you guys are going to re-invent Turbine
> or not. ;-)

nah, i think i'll pass on that.  you Turbine developers seem to do that
enough.   how many active versions are being worked on out there right now?
;-)

seriously though, it's a good point.  we do need to watch that this
vel-tools stuff is built to work with frameworks, not be one.  and i think
we're doing alright with that so far.

Nathan Bubna
nathan@esha.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Confused Developer... (was Re: ToolLoader tool)

Posted by Nathan Bubna <na...@esha.com>.
Jeff said:
> I'm lost at the issues here. Can someone please summarize the issues or
> point out some stuff in the archives? I'm very confused. I don't see how
> ToolLoader mixes up the model and controller into the view.

the question at hand has been "what's the best time/method to place tools
into the context?"

the tool loader approach that Bill is suggesting would have the tools loaded
into the context by the templates themselves.  e.g.

#set( $myTool = $toolloader.load("myTool") )

the opposing suggestion is the exemplified by the current approach in the
veltools/VelocityViewServlet code where the tools are placed in the context
automatically for every template via the ToolboxManager.

as far as i understand, both methods are variations on the Pull MVC model.
the first one (Bill's suggestion), tries to improve performance over the
current style by only loading the necessary tools.  whether that actually
does improve performance is highly questionable in my opinion.   also, Jon
feels that using a ToolLoader in such a fashion puts too much control in the
hands of the template designer and thus is a poorer MVC model.  i tend to
agree, but mostly, i think it makes for more work without much to gain from
it.

> My questions are:
> . What if I don't want to use Turbine? I may want to use Struts or an
> Oracle framework, but I don't want to give up using Pull method with
> Velocity.

you don't even have to know what Turbine is if you don't want (although it's
a pretty good framework, so that might not be a bad idea).  you certainly
don't have to use it though.   the VelocityViewServlet is an entirely
separate and with the ToolboxManager stuff, it implements the Pull MVC model
just fine on it's own.  if you want to use it in conjunction with Struts to
do more framework-ish stuff like Actions/form handling, then by all means,
go for it!

> . Can some explain why ToolLoader is bad? What is good?

eh.  well, the current ToolLoader is bad because it allows/encourages the
designer to instantiate any class with a default no-arg constructor, and it
isn't in line with the current ToolboxManager approach.  Bill's suggestion
could/would make the ToolLoader much more secure.  as for whether or not his
suggested approach is bad or good, i'll leave that to others to argue about.
i mostly don't like it because it's more work, and i don't see much of
anything to gain from the extra work.

> . Isn't this a Pull method?

uh.  i'm not sure what you're referring to by "this", but i'm gonna say yes.
:-)

> . If Turbine has indeed done this already, can we refactor functionally
> out so it doesn't depend on Turbine?

*nothing* in the velocity-tools project is at all dependent on Turbine, nor
will it ever be.

Nathan Bubna
nathan@esha.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Confused Developer... (was Re: ToolLoader tool)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 5/20/02 3:45 PM, "Jeff Duska" <Je...@noaa.gov> wrote:

> Geir Magnusson Jr. wrote:
> 
>> Tool loading like this can be dangerous depending on what can be specified
>> for the load.  
>> 
> If I understand, you correctly -- we are protecting the template
> developer by limiting the access they have. So, they don't or can't do
> something stupid like request 1,000,000 row result from a database.
> Gosh, this is so different from the Microsoft ASP world I'm comming
> from. In the Microsoft world, not only is this something you can do
> typically it is encourgaed by Microsoft in the MSDN examples. ;-)

That's it.  So no

  $dbtool.execute("DROP DATABASE ACCOUNTING");

:)

> 
>> That said, I don't trust the controller author either, so I limit the tools
>> available :)
>> 
> Sound like you have some trust issues ;) (Just kiddin')

Yes, especially since I write the controllers, I know who the audience is.

 
[SNIP]

> 
>> VVS and Turbine aren't comparable.  VVS isn't an application framework
>> (although you could build one around it).  VVS was originally meant to be a
>> rendering servlet a la JSPServlet, so we could have a view system that could
>> be added to JSP-centric frameworks like Struts.
>> 
>> Turbine is an application framework, with all the support one might expect.
>> It is a competitor to Struts.
>> 
> I think you misunderstood me here. The impression I got from Jon's email
> was that there was a portion of this work already done in Turbine. He
> may have been talking about Bill's tool, I'm not sure. I understand that
> the goal is keep VVS application framework independant, which is
> something I like. I was just saying if there is any code we can reuse --
> then lets look at it. If there isn't no big deal. As I said, I really
> lazy... ;)

Me too.

-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Confused Developer... (was Re: ToolLoader tool)

Posted by Jeff Duska <Je...@noaa.gov>.
Geir Magnusson Jr. wrote:

>Tool loading like this can be dangerous depending on what can be specified
>for the load.  
>
If I understand, you correctly -- we are protecting the template 
developer by limiting the access they have. So, they don't or can't do 
something stupid like request 1,000,000 row result from a database. 
Gosh, this is so different from the Microsoft ASP world I'm comming 
from. In the Microsoft world, not only is this something you can do 
typically it is encourgaed by Microsoft in the MSDN examples. ;-)  

>That said, I don't trust the controller author either, so I limit the tools available :)
>
Sound like you have some trust issues ;) (Just kiddin')

>First, you generally don't have to make 1 class per template.  I am horribly
>lazy, and generally have one controller servlet for my apps, and then
>'action methods' are invoked within that servlet and they return the
>template to be rendered (after filling the context with appropos data).  So
>the 1 class == 1 template can be easily avoided.
>  
>
Very True. Sorry, I worded that poorly. I know that need have the 
"controller" servlet, but I'm also really lazy. I don't even want to 
write that code, if I don't have too. If I understand things, this is 
where both Turbine and Struts come in. They provide the generic 
controller servlet framework. I'm working with Struts right now, because 
I have a few books on it.  I looked at Turbine, but right now it bit 
overwhelming for a newbie. I figured I could come back an look at it for 
our next project. I know I need to learn it, before I can dig into 
Jetspeed.  

>VVS and Turbine aren't comparable.  VVS isn't an application framework
>(although you could build one around it).  VVS was originally meant to be a
>rendering servlet a la JSPServlet, so we could have a view system that could
>be added to JSP-centric frameworks like Struts.
>
>Turbine is an application framework, with all the support one might expect.
>It is a competitor to Struts.
>
I think you misunderstood me here. The impression I got from Jon's email 
was that there was a portion of this work already done in Turbine. He 
may have been talking about Bill's tool, I'm not sure. I understand that 
the goal is keep VVS application framework independant, which is 
something I like. I was just saying if there is any code we can reuse -- 
then lets look at it. If there isn't no big deal. As I said, I really 
lazy... ;)

Thanks for the informative email,

Jeff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Confused Developer... (was Re: ToolLoader tool)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 5/20/02 11:14 AM, "Jeff Duska" <Je...@noaa.gov> wrote:

> I'm lost at the issues here. Can someone please summarize the issues or
> point out some stuff in the archives? I'm very confused. I don't see how
> ToolLoader mixes up the model and controller into the view.

It doesn't mix model and controller necessarily.

Tool loading like this can be dangerous depending on what can be specified
for the load.  

If it's is a preconfigured set of classes, it's no different fundamentally
than a controller-fed context, where the tools are placed into the context
by the controller for the view to use.  The only difference between a loader
and the controller doing is is that the template has the freedom to call the
tool what it wants, for whatever that is worth.

If it is not a preconfigured set of classes, then it can be very dangerous
if you are allowed to specify the classname you want.

Bill's tool came from (in part) my mention of a facility I put in another
scipty language I did for a workflow engine.  Even then, I limit the classes
that the template author can ask for.  There is a difference - in my
workflow system, the script is really a controller.  That said, I don't
trust the controller author either, so I limit the tools available :)

And in special cases, where the tool involves heavy lifting of sorts (for
example, there is a tool that maintains continuous connections to a server),
that is pushed into the context by the underlying framework when needed - it
isn't made available in the tool creation facility...

> 
> I'm only looking at this for the point of using the VelocityViewServlet,
> which I like a lot. This means I don't have to create a class for every
> template file I create. This seems like a big advantage, but Jon seems
> to be implying that part of the VelocityViewServlet -- ToolLoader is
> flawed because it mixes the model and the controller.  Plus, it has
> already been done better in Turbine. Third, he also seems to be the
> implying that this is not a Pull method, which I thought it was. I hope
> I've actually summarized Jon's issues. If not, please please feel free
> to correct me.

First, you generally don't have to make 1 class per template.  I am horribly
lazy, and generally have one controller servlet for my apps, and then
'action methods' are invoked within that servlet and they return the
template to be rendered (after filling the context with appropos data).  So
the 1 class == 1 template can be easily avoided.

VVS and Turbine aren't comparable.  VVS isn't an application framework
(although you could build one around it).  VVS was originally meant to be a
rendering servlet a la JSPServlet, so we could have a view system that could
be added to JSP-centric frameworks like Struts.

Turbine is an application framework, with all the support one might expect.
It is a competitor to Struts.

> 
> My questions are:
> . What if I don't want to use Turbine? I may want to use Struts or an
> Oracle framework, but I don't want to give up using Pull method with
> Velocity.

That's the point of VVS + the Struts tools - so you can use Vel with Struts.

> . Can some explain why ToolLoader is bad? What is good?
> . Isn't this a Pull method?
> . If Turbine has indeed done this already, can we refactor functionally
> out so it doesn't depend on Turbine?
> 
> 
> Thanks,
> 
> Jeff
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Confused Developer... (was Re: ToolLoader tool)

Posted by Jeff Duska <Je...@noaa.gov>.
I'm lost at the issues here. Can someone please summarize the issues or 
point out some stuff in the archives? I'm very confused. I don't see how 
ToolLoader mixes up the model and controller into the view.

I'm only looking at this for the point of using the VelocityViewServlet, 
which I like a lot. This means I don't have to create a class for every 
template file I create. This seems like a big advantage, but Jon seems 
to be implying that part of the VelocityViewServlet -- ToolLoader is 
flawed because it mixes the model and the controller. Plus, it has 
already been done better in Turbine. Third, he also seems to be the 
implying that this is not a Pull method, which I thought it was. I hope 
I've actually summarized Jon's issues. If not, please please feel free 
to correct me.

My questions are:
. What if I don't want to use Turbine? I may want to use Struts or an 
Oracle framework, but I don't want to give up using Pull method with 
Velocity.
. Can some explain why ToolLoader is bad? What is good?
. Isn't this a Pull method?
. If Turbine has indeed done this already, can we refactor functionally 
out so it doesn't depend on Turbine?


Thanks,

Jeff



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Terry Steichen <te...@net-frame.com>.
Jon,

Sometimes the line between ridicule and joking gets kinda blurry (at least
from the recipient's point of view, despite the plethora of smiley-winkeys).

We do disagree on several points, but let's both avoid insisting that we are
'right' and the other view is 'wrong.'  If you can live with that, so can I
(and the list will be happier, I think).

So Truce?

Regards,

Terry (aka 'dude') ;-}


----- Original Message -----
From: "Jon Scott Stevens" <jo...@latchkey.com>
To: "velocity-dev" <ve...@jakarta.apache.org>
Sent: Sunday, May 19, 2002 5:10 PM
Subject: Re: ToolLoader tool


> on 5/19/02 1:22 PM, "Terry Steichen" <te...@net-frame.com> wrote:
>
> > It would be nice to see a simple, informative, non-ridicule comment from
> > you.
>
> Lighten up dude...I was more joking with you than anything. Maybe you
missed
> the plethora of ;-)
>
> > 1) Your assertion that I agree with you reflects something other than my
> > views. (Hint1: what do you call it when someone declares they know what
I
> > believe when that is at odds with what I actually do believe? Hint2: It
> > starts with an 'A'. )
>
> Huh?
>
> > 2) Regarding RAD, the advantage of making a change in the template and
> > running the change immediately is much faster than a recompile and
> > restarting the servlet container. (The ratio, for Tomcat, is about 15:1,
all
> > things considered.)
>
> Eh? Your reference to RAD had nothing to do with recompiling templates.
>
> > 3) Absolute trust in the developer and absolute distrust for the
designer
> > isn't 'reality world'. (I have another term for it, but won't engage in
the
> > ridicule I object to.)
>
> Eh? I never said anything about 'absolute distrust'.
>
> What I was referring to was the fact that most designers don't give a rats
> ass about coding and like Tim said, the designer is going to balk at an
> extra confusing line of VTL every time they want to use a tool.
>
> I simply dispelled your points of justification for doing things the wrong
> way and you are getting all pissy about it.
>
> > 4) If your statement is true that appropriate code reuse is only
achievable
> > by use of  JSP, we're really in trouble. (But I don't buy it at all.)
>
> Eh? Where did you get that statement from?
>
> > 5) I admit to not knowing much about Turbine - For nearly a year I have
been
> > using a different framework (with Velocity) that works great so I've had
> > little reason to learn about yet another one.  Far from trying to
're-invent
> > Turbine', I've just been ignoring it.
>
> See, there is your problem right there...;-)
>
> -jon
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 5/19/02 1:22 PM, "Terry Steichen" <te...@net-frame.com> wrote:

> It would be nice to see a simple, informative, non-ridicule comment from
> you.

Lighten up dude...I was more joking with you than anything. Maybe you missed
the plethora of ;-)

> 1) Your assertion that I agree with you reflects something other than my
> views. (Hint1: what do you call it when someone declares they know what I
> believe when that is at odds with what I actually do believe? Hint2: It
> starts with an 'A'. )

Huh?

> 2) Regarding RAD, the advantage of making a change in the template and
> running the change immediately is much faster than a recompile and
> restarting the servlet container. (The ratio, for Tomcat, is about 15:1, all
> things considered.)

Eh? Your reference to RAD had nothing to do with recompiling templates.

> 3) Absolute trust in the developer and absolute distrust for the designer
> isn't 'reality world'. (I have another term for it, but won't engage in the
> ridicule I object to.)

Eh? I never said anything about 'absolute distrust'.

What I was referring to was the fact that most designers don't give a rats
ass about coding and like Tim said, the designer is going to balk at an
extra confusing line of VTL every time they want to use a tool.

I simply dispelled your points of justification for doing things the wrong
way and you are getting all pissy about it.

> 4) If your statement is true that appropriate code reuse is only achievable
> by use of  JSP, we're really in trouble. (But I don't buy it at all.)

Eh? Where did you get that statement from?

> 5) I admit to not knowing much about Turbine - For nearly a year I have been
> using a different framework (with Velocity) that works great so I've had
> little reason to learn about yet another one.  Far from trying to 're-invent
> Turbine', I've just been ignoring it.

See, there is your problem right there...;-)

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Terry Steichen <te...@net-frame.com>.
Jon,

It would be nice to see a simple, informative, non-ridicule comment from
you.

But, alas....

1) Your assertion that I agree with you reflects something other than my
views. (Hint1: what do you call it when someone declares they know what I
believe when that is at odds with what I actually do believe? Hint2: It
starts with an 'A'. )

2) Regarding RAD, the advantage of making a change in the template and
running the change immediately is much faster than a recompile and
restarting the servlet container. (The ratio, for Tomcat, is about 15:1, all
things considered.)

3) Absolute trust in the developer and absolute distrust for the designer
isn't 'reality world'. (I have another term for it, but won't engage in the
ridicule I object to.)

4) If your statement is true that appropriate code reuse is only achievable
by use of  JSP, we're really in trouble. (But I don't buy it at all.)

5) I admit to not knowing much about Turbine - For nearly a year I have been
using a different framework (with Velocity) that works great so I've had
little reason to learn about yet another one.  Far from trying to 're-invent
Turbine', I've just been ignoring it.

Regards,

Terry



----- Original Message -----
From: "Jon Scott Stevens" <jo...@latchkey.com>
To: "velocity-dev" <ve...@jakarta.apache.org>
Sent: Sunday, May 19, 2002 4:03 PM
Subject: Re: ToolLoader tool


> on 5/19/02 12:05 PM, "Terry Steichen" <te...@net-frame.com> wrote:
>
> > I believe we start confusing ends and means when we get too strident
about
> > defining what a so-called Designer 'should' do, and what a Developer
> > 'should' do - especially when we seek to have software 'enforce' that
set of
> > 'shoulds'.
> >
> > We, of course, have lots of experience accumulated regarding what might
be
> > called 'best practices', and we are wise to take full advantage of that
> > experience.  (As was mentioned, there are 'years' of discussion on this
in
> > the various lists.) But too often the declaration of 'shoulds' takes on
a
> > kind of religious 'truth' (the intensity of which is often reflected in
the
> > heavy use of CAPITAL LETTERS to blast this 'truth' into the
consciousness of
> > questioners, heretics, blasphemers -sp? or merely the dim-witted).
>
> People need guidance. This is done by providing a framework of best
> practices and letting them figure out that that framework is trying to
tell
> them. Since this is the velocity DEVELOPERS list, one can assume that the
> people here care about helping develop a tool and set of practices that
> others can use. This is exactly where the should's and must's should be
> discussed.
>
> > That being said, and everything else being equal (talk about
> > equivocating!!), the MVC model and it's functional separation is
probably
> > the best approach.
>
>  In other words:
>
> "I agree with Jon cause he knows what he is talking about, but since I'm
not
> able to directly agree with him for fear of actually admitting he is
right,
> I'm not going to admit it directly."
>
> ;-)
> ;-)
> ;-)
>
> > However, there are other situations in which may well justify deviations
> > from that approach.  Examples that come immediately to mind include
those in
> > which (a) the Designer and the Developer (and, most importantly, the
> > Maintainer) are (and will remain) one and the same,
>
> IMHO that even more of a reason to do it right.
>
> > (b) the Developer needs
> > a RAD capability (perhaps to quickly prototype a potential solution),
>
> It doesn't take any longer to develop things with the model I'm talking
> about.
>
> > (c)
> > the Designer is fully trusted (so you don't have worry about intentional
or
> > unintentional goofs),
>
> Sorry, I live in reality world. ;-)
>
> > or, (d) the Designer has a reasonable skill with
> > procedural structures.  In addition, such deviations may be justified
where
>
> Sorry, I live in reality world. ;-)
>
> > (e) the design of the particular system is such that the best overall
> > code/function reusability is accomplished by adding a bit more
complexity to
> > the template (than would otherwise be considered ideal).
>
> Wow, you should work for Sun and push JSP. ;-) You almost have a
convincing
> argument. Not. ;-)
>
> > IMHO, Velocity would ideally be structured to default to the MVC model,
but
> > would allow (without too much convoluted effort) to support situations
such
> > as those listed above.
>
> Velocity is already there...nothing in Velocity is going to change
regarding
> supporting anything that already exists...
>
> What needs to be figured out is if you guys are going to re-invent Turbine
> or not. ;-)
>
> -jon
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 5/19/02 12:05 PM, "Terry Steichen" <te...@net-frame.com> wrote:

> I believe we start confusing ends and means when we get too strident about
> defining what a so-called Designer 'should' do, and what a Developer
> 'should' do - especially when we seek to have software 'enforce' that set of
> 'shoulds'.
> 
> We, of course, have lots of experience accumulated regarding what might be
> called 'best practices', and we are wise to take full advantage of that
> experience.  (As was mentioned, there are 'years' of discussion on this in
> the various lists.) But too often the declaration of 'shoulds' takes on a
> kind of religious 'truth' (the intensity of which is often reflected in the
> heavy use of CAPITAL LETTERS to blast this 'truth' into the consciousness of
> questioners, heretics, blasphemers -sp? or merely the dim-witted).

People need guidance. This is done by providing a framework of best
practices and letting them figure out that that framework is trying to tell
them. Since this is the velocity DEVELOPERS list, one can assume that the
people here care about helping develop a tool and set of practices that
others can use. This is exactly where the should's and must's should be
discussed.

> That being said, and everything else being equal (talk about
> equivocating!!), the MVC model and it's functional separation is probably
> the best approach.

 In other words: 

"I agree with Jon cause he knows what he is talking about, but since I'm not
able to directly agree with him for fear of actually admitting he is right,
I'm not going to admit it directly."

;-)
;-)
;-)

> However, there are other situations in which may well justify deviations
> from that approach.  Examples that come immediately to mind include those in
> which (a) the Designer and the Developer (and, most importantly, the
> Maintainer) are (and will remain) one and the same,

IMHO that even more of a reason to do it right.

> (b) the Developer needs
> a RAD capability (perhaps to quickly prototype a potential solution),

It doesn't take any longer to develop things with the model I'm talking
about.

> (c)
> the Designer is fully trusted (so you don't have worry about intentional or
> unintentional goofs),

Sorry, I live in reality world. ;-)

> or, (d) the Designer has a reasonable skill with
> procedural structures.  In addition, such deviations may be justified where

Sorry, I live in reality world. ;-)

> (e) the design of the particular system is such that the best overall
> code/function reusability is accomplished by adding a bit more complexity to
> the template (than would otherwise be considered ideal).

Wow, you should work for Sun and push JSP. ;-) You almost have a convincing
argument. Not. ;-)

> IMHO, Velocity would ideally be structured to default to the MVC model, but
> would allow (without too much convoluted effort) to support situations such
> as those listed above.

Velocity is already there...nothing in Velocity is going to change regarding
supporting anything that already exists...

What needs to be figured out is if you guys are going to re-invent Turbine
or not. ;-)

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Terry Steichen <te...@net-frame.com>.
I believe we start confusing ends and means when we get too strident about
defining what a so-called Designer 'should' do, and what a Developer
'should' do - especially when we seek to have software 'enforce' that set of
'shoulds'.

We, of course, have lots of experience accumulated regarding what might be
called 'best practices', and we are wise to take full advantage of that
experience.  (As was mentioned, there are 'years' of discussion on this in
the various lists.) But too often the declaration of 'shoulds' takes on a
kind of religious 'truth' (the intensity of which is often reflected in the
heavy use of CAPITAL LETTERS to blast this 'truth' into the consciousness of
questioners, heretics, blasphemers -sp? or merely the dim-witted).

That being said, and everything else being equal (talk about
equivocating!!), the MVC model and it's functional separation is probably
the best approach.

However, there are other situations in which may well justify deviations
from that approach.  Examples that come immediately to mind include those in
which (a) the Designer and the Developer (and, most importantly, the
Maintainer) are (and will remain) one and the same, (b) the Developer needs
a RAD capability (perhaps to quickly prototype a potential solution), (c)
the Designer is fully trusted (so you don't have worry about intentional or
unintentional goofs), or, (d) the Designer has a reasonable skill with
procedural structures.  In addition, such deviations may be justified where
(e) the design of the particular system is such that the best overall
code/function reusability is accomplished by adding a bit more complexity to
the template (than would otherwise be considered ideal).

IMHO, Velocity would ideally be structured to default to the MVC model, but
would allow (without too much convoluted effort) to support situations such
as those listed above.

Just my $0.02.

Regards,

Terry Steichen






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: ToolLoader tool

Posted by Tim Colson <tc...@cisco.com>.
Folks - I am on board with Jon on this one. 

Jon wrote:
> Think in terms of someone who is editing the template who has 
> no idea of what a tool even is. All they know is that if they 
> put '$ticker.getSymbol("RHAT")' into the template that they 
> will get a number as a result.

I don't believe that a Designer should instantiate a tool in the
template. A tool would be available only if a Developer put it there. 

IMHO, the optimization/lazy loading Bill presents is something that the
Developer/Framework should handle, not the Template Designer. 

Think of the Designer who knows he can "instantiate" a tool called
"Ticker" by using some mojo like so:

#set ( $ticker = $FunkyToolLoader.load("CoolStockTickerVersion3",
"ticker") )
$ticker.getSymbol("RHAT")

So the Designer only loads that tool whenever she 'needs' it and that
makes the system faster?

I doubt it. ;-) I bet the Designer will say, "Why the #$@# do I write
that load thing, it's confusing? And if I want that tool on every page,
do I need to do that #SET on every $#@# page? Ugh."

--

My understanding of the Toolbox was that it was to help the Developer
config/create tool objects automagically to help with rapid prototyping.

Gabe/Geir - what say you gents? Is that correct? If not, what's the
vision/spec for the Tool Loader?

Cheers,
Tim




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 5/19/02 7:37 AM, "Bill Boland" <bo...@attbi.com> wrote:

> Jon,
> 
> To me, this is just a higher abstraction of the Pull vs. Push MVC Model
> that was authored by you in Turbine
> (http://jakarta.apache.org/turbine/turbine-2/pullmodel.html). It gives
> the Java developer control to say which tools are safe for template
> designers to use (pull) into any pages that the tool loader tool is
> available in the context. If you don't want them to pull any tools,
> don't put the tool loader tool into the context. If you want three tools
> to be pulled (format, math, myCustomTool), place those into the map,
> include the tool loader tool in the context and allow the template
> designers to pull out the tools they need for the templates they work
> design.

Please read the article again. You are mistaking my intentions around the
Pull Model.

It isn't about 'Pulling Tools into the Context'. It is about having the
tools made available in the context and 'pulling data from the tools'.

As I already said, pulling tools by instantiating objects and defining their
scope in the template is wrong. At that point, you are essentially putting
WAY to much logic into the hands of the web designer. This is the SAME
problem with taglibs. You define the scope of the taglib in the page. That
isn't MVC.

I even discuss this issue of scope in the template:
    <http://jakarta.apache.org/velocity/ymtd/ymtd-javabeans.html>

Think in terms of someone who is editing the template who has no idea of
what a tool even is. All they know is that if they put
'$ticker.getSymbol("RHAT")' into the template that they will get a number as
a result.

> I just didn't feel that the "approved" tools (if any) should be
> constructed until they are really used for a specific template and the
> template designer should know them by a "common" name, not a class name.
> "Lazy" construction of the tools just allows for improved performance
> for templates that don't use any/all of them.

There is no reason to do that since those type of tools are essentially
'global' tools and are just sitting in the context not doing anything so
they aren't hurting anything performance wise.

Experience also says that the global tools will eventually be instantiated
anyway so you might as well do it up front as part of the startup cost.
There is no real benefit to have lazy instantiation of tools.

> Of course, there could be further evolution of this to allow Java
> developers to declare "global" tools and template-specific tools. I
> think this is what the Views sub-project in velocity-tools is trying to
> do (still learning here so I may be wrong). I'm just looking for higher
> abstractions to "declare" the tool availability vs. coding. Eventually,
> it would be nice to have the ability to declare something like the
> following that the central template engine would use to prepare the
> context prior to merging them:
> 
> *.vm:           formatTool, myCustomTool
> orderForm.vm:   mathTool
> home.vm:        newsTool

No. You really don't need that level of control and even if you did, that
would be done in the framework, not by coding the instantiation of tools in
the actual templates.

Here is why:

Say you have a designer who knows only a little bit about programming. They
want to do something cool and put the stock ticker into their random page.

Now, why should they have to come back to you to edit a configuration file
or define something new (ie: your example above) that allows them to access
the tool? Instead, they should just have an API that you provide that tells
them what tools and methods they have access to. Done. Less headache for
everyone.

You can also do things like have the tool control its own security so that
it can tell (by the webapp framework) what template it is in and decide
whether or not to render itself. We do something like this in Scarab with
the LinkTool and it works quite well.

> There so much out here, that this may exist already and I just haven't
> come upon it yet. Having tools (and tools for tools) be flexible for the
> many various projects that exist in the world is a great challenge.
> Every one doesn't wear the same size or style of shoe and some go
> barefoot! 

You really need to spend more time with Turbine3. Cause we have already
solved quite a few of these problems and are developing Scarab as a sort of
test case to show that this stuff really is the right way to go.

> I'm learning, listening and contributing.

Spend time with Turbine before you start doing anything more. Look at how we
do things and then comment on that. You may also wish to read the archives
of this list and the turbine-dev list. There is *years* worth of discussion
about this stuff.

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: ToolLoader tool

Posted by Bill Boland <bo...@attbi.com>.
Jon,

To me, this is just a higher abstraction of the Pull vs. Push MVC Model
that was authored by you in Turbine
(http://jakarta.apache.org/turbine/turbine-2/pullmodel.html). It gives
the Java developer control to say which tools are safe for template
designers to use (pull) into any pages that the tool loader tool is
available in the context. If you don't want them to pull any tools,
don't put the tool loader tool into the context. If you want three tools
to be pulled (format, math, myCustomTool), place those into the map,
include the tool loader tool in the context and allow the template
designers to pull out the tools they need for the templates they work
design.

I just didn't feel that the "approved" tools (if any) should be
constructed until they are really used for a specific template and the
template designer should know them by a "common" name, not a class name.
"Lazy" construction of the tools just allows for improved performance
for templates that don't use any/all of them.

Of course, there could be further evolution of this to allow Java
developers to declare "global" tools and template-specific tools. I
think this is what the Views sub-project in velocity-tools is trying to
do (still learning here so I may be wrong). I'm just looking for higher
abstractions to "declare" the tool availability vs. coding. Eventually,
it would be nice to have the ability to declare something like the
following that the central template engine would use to prepare the
context prior to merging them:

*.vm:           formatTool, myCustomTool
orderForm.vm:   mathTool
home.vm:        newsTool

There so much out here, that this may exist already and I just haven't
come upon it yet. Having tools (and tools for tools) be flexible for the
many various projects that exist in the world is a great challenge.
Every one doesn't wear the same size or style of shoe and some go
barefoot! 

I'm learning, listening and contributing.

bill

-----Original Message-----
From: Jon Scott Stevens [mailto:jon@latchkey.com] 
Sent: Saturday, May 18, 2002 10:34 PM
To: velocity-dev
Subject: Re: ToolLoader tool

I honestly believe that tools should not be loaded within VTL. It isn't
MVC.
Velocity is the VIEW and you are confusing the MC by creating this.

The framework which handles the MC should be responsible for loading
tools
and making them available in the context (as well as controlling the
scope
of the tools).

But, I'm sure that none of you will listen to me. So do whatever you
want.

-jon


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ToolLoader tool

Posted by Jon Scott Stevens <jo...@latchkey.com>.
I honestly believe that tools should not be loaded within VTL. It isn't MVC.
Velocity is the VIEW and you are confusing the MC by creating this.

The framework which handles the MC should be responsible for loading tools
and making them available in the context (as well as controlling the scope
of the tools).

But, I'm sure that none of you will listen to me. So do whatever you want.

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: ToolLoader tool

Posted by Bill Boland <bo...@attbi.com>.
Here's what I came up as a few enhancements to the ToolLoader. It seems
to work fine with the limited testing I did on them.

bill