![]()
This is my blogchalk:
United States, California, San Francisco, Cow Hollow, English, Alison, Female, 31-35.
| Saturday, February 08, 2003 | |
I was getting really frustrated debugging a jsp yesterday. The screen revealed an ugly spew of System.out.println() debug statements had rendered my code unreadable. Realizing I was mired in reckless hacker mode, I turned off the monitor, took a breath, and decided to come up with three different ways to uncover the bug before returning to the keyboard. I grabbed my neglected copy of Refactoring for help. I had forgotten what fun this book can be.
I love the concept of code smells, "deciding when to start refactoring, and when to stop, is just as important to refactoring as knowing how to operate the mechanics of refactoring". I realized that I often resist working on this jsp-servlet project because I am not seasoned enough with J2EE to recognize the code smells. In other words, I know I am unhappy with the project's code, but I don't know why.
I also reviewed the catalog's "Composing Methods" and "Simplifying Conditional Expressions" sections. Below the name is a short summary of the situation in which you need the refactoring and a summary of what the refactoring does. Under Extract Method: "You have a code fragment that can be grouped together. Turn the fragment into a method whose name explains the purpose of the method." Under Decompose Conditional: "You have a complicated conditional (if-then-else) statement. Extract methods from the condition, then part, and else parts."
As for my jsp problem, the refactoring I used was not from the book or even Martin Fowler. It did conform to the structure of a good refactoring: it had nice, terse sections on Motivation and Mechanics, and the example was thorough (though it did meander off course at times). It was such a relief to locate this little gem, and the "Mechanics" to guide me off of the endless out.println() hamster wheel.
--------------------------------------------------------------------------------
See Also:
As much as I love AllConsuming, the "currently reading" javascript is making my page unloadable. When I get the change I think I will replace the js with a hard-coded version including the cover art, title and links.
Has anyone else experienced this?
Cool!
While surfing the Radio top 100 list, I notice that The Cartoonist has a simple search box just below the calendar. I didn't think I could find a free service (such as Google) until I got my own domain. I thought wrong.
So I added a search box using Pico's free search service. Now I am compliant with Day 29's recommendations for a more accessible website.