Refactoring old tags: Tag Files ( mother of a refactor)

Refactoring old tags: Tag Files ( mother of a refactor)

Post by VisionSe » Tue, 08 Aug 2006 18:24:37



We have a poor tag solution for our content management system that
relies on html coments used as tags in a plain html file.
This file is parsed out by a *jsp* page line by line as a fileStream.
Each tag is replaced by laborious String library funcionality indexOf
etc.
So you get horrible scriplet syntax where content is all quoted in
String declarations.
Obviously content such as this is best presented as free format html or
jsp.
My idea towards improvement is to use tag libraries - I think called
Tag Files? I can replace the old html comment tags with jsp custom
tags to specifically solve the ugly parseing we have at the moment.
Does this sound like the right approach as one step in my Mother of a
Refactor?
 
 
 

Refactoring old tags: Tag Files ( mother of a refactor)

Post by Andy Dingl » Wed, 09 Aug 2006 00:42:18


Sounds good.


One step - certainly very good.

However the first step in _refactoring_ is always the same. Set up an
automated test environment so that you can verify your "refactorings"
aren't changing anything. If you don't do this first, then you might be
"reworking" the code, but you aren't refactoring it in a controlled
manner.

 
 
 

Refactoring old tags: Tag Files ( mother of a refactor)

Post by Andrea Des » Wed, 09 Aug 2006 01:09:04


It's not completely clear, but yes, I would say so.
What you should also consider is that maybe it's possible to do
everything just with the regular tags. With JSTL it's also possible to
do an XSLT transform (although I have never tried it). For what I
understand your situation is, maybe it's a good option
 
 
 

Refactoring old tags: Tag Files ( mother of a refactor)

Post by VisionSe » Wed, 09 Aug 2006 17:28:16


Yes we are doing that, but that is a known.
I wnat to be thinking a step ahead.

The template file we have at present is not a jsp. It is just a source
of parseing.
A JSP parses this template file. Now I want to replace 1 tag at a
time. So that the file continues to work on the old system, being
parsed but also acts as a JSP page in that the new custom tags are
handled by the container. How can I do that?

TIA,
Mike W