You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Geir Magnusson Jr." <ge...@optonline.net> on 2001/05/18 14:14:22 UTC

[1.1 issue] event handler

the event handling stuff is currently in org.apache.velocity.context,
which is the wrong place.  It is there simply because that's where it
was convenient to play with it.

Anyone have a big problem if we move it?  It's new to 1.1, so we have
the chance now.

org.apache.velocity.event ?

org.apache.velocity.app.event ?

I am more inclined towards the latter one, as we don't need more top
level packagenames, I believe, and it is an application API

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Re: [1.1 issue] event handler

Posted by Christoph Reck <Ch...@dlr.de>.
+0, I've not had a chance to test it, I'll upgrade soon...

"Geir Magnusson Jr." wrote:
> 
> the event handling stuff is currently in org.apache.velocity.context,
> which is the wrong place.  It is there simply because that's where it
> was convenient to play with it.
> 
> Anyone have a big problem if we move it?  It's new to 1.1, so we have
> the chance now.
> 
> org.apache.velocity.event ?
> 
> org.apache.velocity.app.event ?
> 
> I am more inclined towards the latter one, as we don't need more top
> level packagenames, I believe, and it is an application API
> 
> geir
> 
> --
> Geir Magnusson Jr.                           geirm@optonline.net
> System and Software Consulting
> Developing for the web?  See http://jakarta.apache.org/velocity/
> "still climbing up to the shoulders..."

RE: [1.1 issue] event handler - and names!!!

Posted by Paulo Gaspar <pa...@krankikom.de>.
> Yea or nea on *.velocity.apps.events ?

Yea, yea, yea!!!
=:o)

And it is nice to know that you agree with the names.


Have fun,
Paulo


Re: [1.1 issue] event handler - and names!!!

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Paulo Gaspar wrote:
> 
> Answer inline:
> 
> > -----Original Message-----
> > From: gmj@mta6.srv.hcvlny.cv.net [mailto:gmj@mta6.srv.hcvlny.cv.net]On
> > Behalf Of Geir Magnusson Jr.
> >
> > Paulo Gaspar wrote:
> > >
> > > But wouldn't it be better to also consider what is essential and what
> > > is optional? Isn't *.velocity.app the place for application tools?
> >
> > I guess I don't think of it as tools, but the application-centric API.
> > I mean, the point of the Velocity class is to not only supply some
> > useful extra stuff, but decouple application programs from Runtime -
> > that's why you should use the Velocity class init(), getTemplate(),
> > setProperty(), etc, rather than use Runtime.
> >
> > It gives us the degree of freedom to change the underlying impl of
> > Runtime.
> 
> Ok, my bad interpretation.
> That way I don't know anymore.

?

Yea or nea on *.velocity.apps.events ?

> 
> > > Some extra remarks on the Event Handlers:
> > >   - In NullSetEventHandler, why is the method called
> > >     "nullSetLogMessage()"? One does not have to log the message and no
> > >     message is directly involved. What about "nullSetAttempt()"?
> >
> > er, the method returns true or false as a vote whether or not to log.
> > it has nothing to do with the #set() of the LHS.
> >
> > This is something I added to solve the problem that the
> >
> > #set($foo = $!bar)
> >
> > and other variants were supposed to address, meaning a 'quiet #set()'.
> 
> Ops! I should have paid more attention to that one!
> The name really says it!

If no one cares about this we can drop it, although it's minor overhead
compared to outputting a log message.
 
> 
> > >   - Why having
> > >       NullReferenceEventHandler.nullReferenceRender()   (1)
> > >     and
> > >       ReferenceInsertionEventHandler.referenceInsert()  (2)
> > >     AFAIK, they do a similar thing, one for non silent null values and
> > >     the other for non null values. Following the pattern of the first
> > >     (1) case, we should have (instead of the second (2))
> > >       ReferenceEventHandler.referenceRender()
> > >     or
> > >       NonNullReferenceEventHandler.nonNullReferenceRender()
> > >
> > > For some people (not you Geir) this might look like a detail, but the
> > > names of classes and methods are the first (most immediate) level of
> > > documentation. They can make reading further documentation unnecessary
> > > or they can induce confusion.
> >
> > Try and keep up, chief. :)
> >
> > NullReferenceEventHandler is gone.  It's redundant.
> 
> You are too fast!
> I took a look at the cvs log just 2 days ago!
> =:o)
> 
> The possibility of it being redundant crossed my mind while writing the
> previous post, but I was not very sure about the whole thing.
> 
> > If you have some alternate suggestions for the methods, please - now is
> > the time to fix this - it will be virtually impossible to do later.
> 
> My favorite event.method() names would be:
>     ReferenceRenderEventHandler.referenceRender()
>         (for the ReferenceInsertionEventHandler.referenceInsert())

That's good too - I think that the 'Insert' came from the notion of
'inserting' into the output stream.
 
> and
>     NullSetEventHandler.shouldLogNullSetAttempt()
>         (for the NullSetEventHandler.nullSetLogMessage())

That's better.  Anyone concur, or would be greviously harmed if change?

Since it does return boolean, this makes more sense...
 
> > And if you have a good suggestion for what package the event stuff can
> > move to, that would be great as well.
> 
> No better ideas than *.velocity.app.events, which puts the events a bit
> apart because,
>  - More events can still pop up;

They certainly will, for sure...

>  - They do not have as much common use as other *.velocity.app classes,
>    and this way they do not clutter that app-common-use package.
> 
> (I am adapting to your POV on *.velocity.app now.)
> 
> 
> I will probably be some 48 hours offline now (ARGH!). I will follow up
> this on Sunday. Thanks for the (as usual) fast answer.

ARGH!

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

RE: [1.1 issue] event handler - and names!!!

Posted by Paulo Gaspar <pa...@krankikom.de>.
Answer inline:

> -----Original Message-----
> From: gmj@mta6.srv.hcvlny.cv.net [mailto:gmj@mta6.srv.hcvlny.cv.net]On
> Behalf Of Geir Magnusson Jr.
> 
> Paulo Gaspar wrote:
> > 
> > But wouldn't it be better to also consider what is essential and what
> > is optional? Isn't *.velocity.app the place for application tools?
> 
> I guess I don't think of it as tools, but the application-centric API. 
> I mean, the point of the Velocity class is to not only supply some
> useful extra stuff, but decouple application programs from Runtime -
> that's why you should use the Velocity class init(), getTemplate(),
> setProperty(), etc, rather than use Runtime.
> 
> It gives us the degree of freedom to change the underlying impl of
> Runtime.

Ok, my bad interpretation.
That way I don't know anymore.

 
> ... stuff we agree on ...
>
> and smaller :)

YEEEEEESSSSSSSSS!!!!

  
> > Some extra remarks on the Event Handlers:
> >   - In NullSetEventHandler, why is the method called
> >     "nullSetLogMessage()"? One does not have to log the message and no
> >     message is directly involved. What about "nullSetAttempt()"?
> 
> er, the method returns true or false as a vote whether or not to log. 
> it has nothing to do with the #set() of the LHS.
> 
> This is something I added to solve the problem that the 
> 
> #set($foo = $!bar) 
> 
> and other variants were supposed to address, meaning a 'quiet #set()'.

Ops! I should have paid more attention to that one!
The name really says it!
 
  
> >   - Why having
> >       NullReferenceEventHandler.nullReferenceRender()   (1)
> >     and
> >       ReferenceInsertionEventHandler.referenceInsert()  (2)
> >     AFAIK, they do a similar thing, one for non silent null values and
> >     the other for non null values. Following the pattern of the first
> >     (1) case, we should have (instead of the second (2))
> >       ReferenceEventHandler.referenceRender()
> >     or
> >       NonNullReferenceEventHandler.nonNullReferenceRender()
> > 
> > For some people (not you Geir) this might look like a detail, but the
> > names of classes and methods are the first (most immediate) level of
> > documentation. They can make reading further documentation unnecessary
> > or they can induce confusion.
> 
> Try and keep up, chief. :)
> 
> NullReferenceEventHandler is gone.  It's redundant.

You are too fast!
I took a look at the cvs log just 2 days ago!
=:o)

The possibility of it being redundant crossed my mind while writing the
previous post, but I was not very sure about the whole thing.


> If you have some alternate suggestions for the methods, please - now is
> the time to fix this - it will be virtually impossible to do later.

My favorite event.method() names would be:
    ReferenceRenderEventHandler.referenceRender()
        (for the ReferenceInsertionEventHandler.referenceInsert())

and
    NullSetEventHandler.shouldLogNullSetAttempt()
        (for the NullSetEventHandler.nullSetLogMessage())
 
> And if you have a good suggestion for what package the event stuff can
> move to, that would be great as well.

No better ideas than *.velocity.app.events, which puts the events a bit
apart because,
 - More events can still pop up;
 - They do not have as much common use as other *.velocity.app classes,
   and this way they do not clutter that app-common-use package.

(I am adapting to your POV on *.velocity.app now.)
 

I will probably be some 48 hours offline now (ARGH!). I will follow up
this on Sunday. Thanks for the (as usual) fast answer.


Have fun,
Paulo Gaspar

Re: [1.1 issue] event handler - and names!!!

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Paulo Gaspar wrote:
> 
> But wouldn't it be better to also consider what is essential and what
> is optional? Isn't *.velocity.app the place for application tools?

I guess I don't think of it as tools, but the application-centric API. 
I mean, the point of the Velocity class is to not only supply some
useful extra stuff, but decouple application programs from Runtime -
that's why you should use the Velocity class init(), getTemplate(),
setPropert(), etc, rather than use Runtime.

It gives us the degree of freedom to change the underlying impl of
Runtime.

> Of course that my interpretation can be wrong, but one thing I would
> really like (and I hope not to be alone on that) is a clear separation
> from what is essential and what is optional, on a package basis.

me too. 
 
> And, believe me, I already have a lot of trouble with this separation
> since my framework provides a lot of functionality that is redundant
> (for me) in Velocity. A clear separation between "core" and "optional"
> (and this has various levels in Velocity) would make its reuse
> simpler for a wider range of usages.

and smaller :)
 
> Some extra remarks on the Event Handlers:
>   - In NullSetEventHandler, why is the method called
>     "nullSetLogMessage()"? One does not have to log the message and no
>     message is directly involved. What about "nullSetAttempt()"?

er, the method returns true or false as a vote whether or not to log. 
it has nothing to do with the #set() of the LHS.

This is something I added to solve the problem that the 

#set($foo = $!bar) 

and other variants were supposed to address, meaning a 'quiet #set()'.

 
>   - Why having
>       NullReferenceEventHandler.nullReferenceRender()   (1)
>     and
>       ReferenceInsertionEventHandler.referenceInsert()  (2)
>     AFAIK, they do a similar thing, one for non silent null values and
>     the other for non null values. Following the pattern of the first
>     (1) case, we should have (instead of the second (2))
>       ReferenceEventHandler.referenceRender()
>     or
>       NonNullReferenceEventHandler.nonNullReferenceRender()
> 
> For some people (not you Geir) this might look like a detail, but the
> names of classes and methods are the first (most immediate) level of
> documentation. They can make reading further documentation unnecessary
> or they can induce confusion.

Try and keep up, chief. :)

NullReferenceEventHandler is gone.  It's redundant.
 
> In my case, at a 1st look, I thought that
>   ReferenceInsertionEventHandler.referenceInsert()
> was a #set() related event (a bit like in NullSetEventHandler) since
> #set can be used to "insert" a value in the context's hash table.
> 
> 
> BTW, since I started making big and complex XML exports, I just fell
> in love for these events. I am starting to use them now and it sure
> avoids a lot of template mess... or data structure code mess.
> 


If you have some alternate suggestions for the methods, please - now is
the time to fix this - it will be virtually impossible to do later.

And if you have a good suggestion for what package the event stuff can
move to, that would be great as well.


geir


-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

RE: [1.1 issue] event handler - and names!!!

Posted by Paulo Gaspar <pa...@krankikom.de>.
But wouldn't it be better to also consider what is essential and what 
is optional? Isn't *.velocity.app the place for application tools?

Of course that my interpretation can be wrong, but one thing I would 
really like (and I hope not to be alone on that) is a clear separation
from what is essential and what is optional, on a package basis.

And, believe me, I already have a lot of trouble with this separation
since my framework provides a lot of functionality that is redundant
(for me) in Velocity. A clear separation between "core" and "optional"
(and this has various levels in Velocity) would make its reuse 
simpler for a wider range of usages.


Some extra remarks on the Event Handlers:
  - In NullSetEventHandler, why is the method called 
    "nullSetLogMessage()"? One does not have to log the message and no
    message is directly involved. What about "nullSetAttempt()"?

  - Why having 
      NullReferenceEventHandler.nullReferenceRender()   (1)
    and 
      ReferenceInsertionEventHandler.referenceInsert()  (2)
    AFAIK, they do a similar thing, one for non silent null values and
    the other for non null values. Following the pattern of the first 
    (1) case, we should have (instead of the second (2))
      ReferenceEventHandler.referenceRender() 
    or
      NonNullReferenceEventHandler.nonNullReferenceRender()


For some people (not you Geir) this might look like a detail, but the 
names of classes and methods are the first (most immediate) level of 
documentation. They can make reading further documentation unnecessary 
or they can induce confusion.

In my case, at a 1st look, I thought that 
  ReferenceInsertionEventHandler.referenceInsert()
was a #set() related event (a bit like in NullSetEventHandler) since
#set can be used to "insert" a value in the context's hash table.
 

BTW, since I started making big and complex XML exports, I just fell 
in love for these events. I am starting to use them now and it sure
avoids a lot of template mess... or data structure code mess.


Thanks for all the good work
...and have fun,

Paulo Gaspar

> -----Original Message-----
> From: gmj@mta4.srv.hcvlny.cv.net [mailto:gmj@mta4.srv.hcvlny.cv.net]On
> Behalf Of Geir Magnusson Jr.
> Sent: Friday, May 18, 2001 2:14 PM
> To: velocity-dev
> Subject: [1.1 issue] event handler
> 
> 
> the event handling stuff is currently in org.apache.velocity.context,
> which is the wrong place.  It is there simply because that's where it
> was convenient to play with it.
> 
> Anyone have a big problem if we move it?  It's new to 1.1, so we have
> the chance now.
> 
> org.apache.velocity.event ?
> 
> org.apache.velocity.app.event ?
> 
> I am more inclined towards the latter one, as we don't need more top
> level packagenames, I believe, and it is an application API
> 
> geir
> 
> -- 
> Geir Magnusson Jr.                           geirm@optonline.net
> System and Software Consulting
> Developing for the web?  See http://jakarta.apache.org/velocity/
> "still climbing up to the shoulders..."
>