I’m having trouble doing effective code reviews. Our team does informal, glance-over reviews of code before check-in, which works when you’re building on an established design, but I have trouble seeing how it works for scattered-out bits of code written by the seat of your pants.
As the CSS expert on the team, it was my responsibility to create a cohesive CSS structure, and use code review to ensure that the devs were using it properly. The Right Thing would have been to identify common page elements up front so that the structure would be consistent everywhere and easy to use. (E.g., IDs versus classes, div vs p, hx vs span, borders vs hrs, padding vs brs, functional vs presentational class names, etc.)
But I’ve let that opportunity slip through my fingers. Partly due to factors beyond my control, the other devs had to proceed without the structure in place. So we have all these different ad hac approaches to fixing this or that alignment problem on individual pages, all these random classes added to the CSS file. Let me emphasize that this is not the devs’ fault! They have done very well under the circumstances. But to achieve the desired level of quality, they would have had to do bottom-up redesign of something outside their area of expertise. I just don’t see how code reviews alone can provide adequate direction.
[I wanted to include an example here, but Blogger can't make up its mind how to process embedded HTML code -- whether to render my divs regardless of wrapping them in code tags; whether or not to expand my already spelled-out &s. (Argh, it did it again!)]
I’m very disappointed in myself, regardless of the causes. The CSS code has my imprimatur, has my name on it, and it’s not what I would have wanted. To fix it, we’d have to refactor the CSS file and then have everyone go back into the markup, changing class names and structural decisions. That ain’t gonna happen (unless we get permission to wind back the clock).
Anyway, back to the purported subject of this post. While looking for articles on code review in Agile methodologies, I happened upon this post which starts with a discussion of the male insistence on trying to navigate and drive simultaneously:
Thanks to these unexpected excursions, I have seen parts of the country side that I might otherwise have missed, but I have no idea where they were or how to get back there. [Hacknot: In Praise of Code Reviews]
The reluctance to stop and read the map is analogous to the reluctance to do code reviews:
This desire to minimize small, short-term pain even at the expense of significantly more pain in the long term is at the core of much self-defeating behavior.
I feel very lost indeed.