Given a long method with Pac-Man ifs, would it be wise to:Break down code blocks into regions.Then refactor code blocks into methods.Or would it be best to leave it alone?Would it be risky?Would it be a waste of time?In the absence of automated unit-tests, I'm trying to understand the risk-reward relationship associated with this manuever.
Refactoring code smells in ASP.NET Web Forms Code Behind Files: Is it risky? Is it wise? Is it a waste of time?
asp.net;refactoring;code smell
Your plan, or clean up the logic on the ifs (in cases where the pacman structure is an inefficient order or view of the conditions) is usually the place to start IMHO.As to if it is worth the effort:do you expect to be changing this page much?do you have trouble understanding what is going on in there to the point you are wary of modifying it?do you think it is causing a performance or stability problem?is there no real reason it was done this way in the first place?would it be trivial to manually validate the correctness of the re-factor?IMHO unless you have some strong yes answers to those questions re-factoring it is a questionable exercise when compared to the risk of botching it and the fact that you could be adding new value elsewhere with your time.