How to safely refactor beans used by JSPs?
My team at Orbitz has started a disscussion page on our wiki. This was one of the questions below and I thought it was worth airing here.
When refactoring a class that may be referenced by a JSP, how do we make sure that we haven't broken a JSP, or at least know that we've broken it?
Example:public interface Foo {
public String getBar();
<c:foreach iteams="${foos}" var="foo">
<c:out value="foo.bar">
</c:out>
</c:foreach>
If we rename getBar() to getBaz(), how do we make sure we haven't broken the above JSP?
Below is my responce:
My First thought is to compile the JSPs. But the EL is compiled ito reflection calls and an exception will be thrown at run time not complie time of the JSP, right? A clutered option is to deprecated the old method and change it to call the new one. Then have some kind of reporting that tells us when a JSP used a deprecated method, then we could clean up these references over time. After a specified time of no calls from JSPs we remove the deprecated method. However, there is no way to ensure all functionality is executed in a time frame.
Do you guys have any thoughts?
3 Comments:
Comprehensive regression tests should be able to find issues like this.
And I assume you have a recomendation for automated regression software?
I do have an automated webtest recommendation. Its called canoo.
Post a Comment
<< Home