RE: refactoring the velocity templates

Jorge Uriarte <[email protected]> Mon, 12 Jan 2009 21:12:55 +0100
Newsgroups gmane.comp.java.scarab.devel
Message-ID <[email protected]>
Not to sound simplistic, but "grep -R" has probed enough for me ;)

Agreed in there's too much logic in the templates, but name-convention-refactoring will not make the complexity dissapear.


----- Mensaje original -----
De: hussayn <[email protected]>
Enviado: lunes, 12 de enero de 2009 20:15
Para: [email protected]
Asunto: refactoring the velocity templates

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=

[No se incluye el mensaje original entero]

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

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