refactoring the velocity templates

hussayn <[email protected]> Mon, 12 Jan 2009 11:15:08 -0800 (PST)
Newsgroups gmane.comp.java.scarab.devel
Message-ID <[email protected]>
Hi;

I want to start some basic refactoring work on the templates. So i took a
closer
look at the velocity files...

Currently we do have a huge intertwinning between backend and frontend
and we even have some significant business logic right within the
velocity templates. And we do have 184 macro definition files, which smells
like
a huge amount of work. So how shall we start on this ?

My very first goal would be to get a clear overview about the interaction
between
velocity and java. My main problem is, that i do not know about any analysis
tool, 
which can safely tell me, which java-methods are called from which
velocity-file,
and which velocity-macros are triggered from a java-method.

So my first thought is to introduce a name convention in the velocity-files
as follows:

1.) prepend "api_" to any reference to the java-api.
     example: $api_SomeJavaClass

2.) for java-references use the name of the associated class.
     example: $api_ScarabRequestTool

3.) prepend "m_" to the name of a macro definition
     example: #macro ( m_advancedQueryFunctionBar )

4.) for local macros (only used in the current .vm file) prepend "lm_" to
the name
     example: #macro ( lm_onlyForLocalUsage )

I considered creating an automatic checker/replacer tool, but soon i found
out, that this 
would be a major development task. OTOH making manual sanity checks on 184
velocity 
files does not sound like much fun. So the question is, if such a check tool
already exists
somewhere... (i have just installed veloedit on eclipse, but it doesnt help
too much here) 

What other possibilities do we have to clean up and refactor the templates ?
Any hints are welcome.

regards,
Hussayn
-- 
View this message in context: http://www.nabble.com/refactoring-the-velocity-templates-tp21421588p21421588.html
Sent from the Scarab - Dev mailing list archive at Nabble.com.

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=455&dsMessageId=1019806

To unsubscribe from this discussion, e-mail: [[email protected]].