Blog Refactoring: No More Action Chaining
Now I'm stuck in the middle of trying to accept TrackBacks and completely refactoring my web tier logic to avoid action chaining completely. This means lots of code still unfit to check back into CVS. :)
My refactoring could be a perfect opportunity to test out some refactoring tools, but that requires me to waste time trying to work in an IDE. I'm pulling all my methods for sticking data in the
HttpServletRequest to be displayed by JSP into their own View classes. With a bit more thought, these can be coupled with actual JSP views as the one-stop method to populate everything a JSP needs to display properly. Secondly, I'm pulling other methods to retrieve and manipulate state data into Logic classes. The standard Action can then get its form input, call a Logic method or 2 to do some state work, call the BlogDelegate (which calls EJB tier) to get or commit data, then call a few View methods to setup for the next JSP. Similar Actions can just call the same methods in the same sequence instead of implementing the logic themselves, and I won't be tempted to chain to another Action, since I can just call the same Logic methods.
The Logic methods include build ArticleRequests, evaluating paging, and finding cookie data. The View methods mostly set Collections and Strings into the request, along with some formatting for display. Since I'm not using any refactoring tools besides, I blow things up then work to get them to compile again. I'm starting to see where a tool could be useful.