setDirty( true )
by in CodeSOD on 2006-11-29Today's code snippet come to us from Carl Cerecke. Carl is currently deep within the bowels of a large government application trying to complete a minor defect fix. This application is used throughout the country of New Zealand by the front line staff dealing with a sizeable percentage of the citizens. Carl knows a couple of these front line staff personally and they hate the software. Carl writes, "I work for the large international software house that has the support and maintenance contract on this impenetrable piece of enterprisey spaghetti code."
Carl continues, "here's a piece of code that has nothing to do with the defect I'm trying to fix. At least I don't think it does. It did, however, jump out at me while scrolling through the file as an exemplar examplar of the sort of code littered around the project. I had to use a pen and paper to work out exactly what conditions the setDirty(true) call was made. It was no real surprise that the if statements can be replaced entirely by a much more understandable one-liner."