As an individual contributor, part of my job is not just making changes but also managing and understanding how files are changing in the design as a whole. Importantly, when I change a file and get set to check it in I need to be sure the changes are correct. If that seems obvious, it is. But truly "correct" goes beyond just running a test suite. I typically check:
- are the comments still correct
- are there any debug print statements that need to be deleted
- are there any temporary experimental changes still hanging around
- are any files changed unexpectedly
- are my files too old to commit
That picture represents 67 changes across almost 800 lines of code. Going through this change by line by line takes 15-20 minutes. The cleanup is worth it. Code that is checked in after this type of last minute read-through goes a long way towards keeping the code the best it can be - outside the domain of pure functionality.
By using tkdiff, I can scroll round up and down from each change. This lets me look at the comments - especially the ones that have not changed next to code that has changed. This is how I keep comments correct.
That last bullet, "are my files too old.." is very important. In this case, when the commit is run one of too things might happen. One, the commit goes through. Or two, the version control tool reports that I can't commit because my changed file is out of data with respect to the server. Two may seem unfortunate, but it is actually better than the first one which can introduce errors later. In the second case, I'm forced to update, and re-run the test suite. Why isn't it OK to just check in when I know my workspace contains a lot of stale (files that have been changed on the server)? Because after I commit my changes the state of the server data is not known - it hasn't been tested yet. It could easily fail the test suite.
What to do about a workspace that is out of date depends on the data that is out of date. If it is related to your change, you really should update your workspace and re-test. If it isn't it might be safe to simply commit the change. But beware, it is always better for your group (your colleagues who will soon see all of your changes!) to check your work first. So finish your changes, then merge with the latest data on the trunk, turn the test suite and deal with any issues yourself. This saves the team valuable time. One way to do this is to "merge early and often." If you never let your workspace get stale, you won't have this issue.
If you can convince everyone on your team the importance of merging early and often. To only run the test suit on data that is as close to HEAD of the tree as possible. You'll find the group will save time by spending less of it sorting things out with those annoying reply-to-all "who checked in xyz and broke everything" emails.
Of course none of this replaces keeping yourself from going dark. There is also the need for periodic peer reviews.
So, how do you manage your check in process?
i'll give you a periodic peer review ...
ReplyDeleteCool, I could use it. Especially with my upcoming post on tuna sandwiches.
ReplyDeletetuna sandwiches, that's my niche mike! i'm tellin' mom. maaaaaaaaaaa ... mike said he was gonna cross over and post about tuna sandwiches!
ReplyDeleteoh, yeah, one more thing. you gonna line catch that tuna off the pier review?
ReplyDeleteI wish I had a graphic way to show the changes to my files as well. It would be a very simple way to measure what I've been doing month to month.
ReplyDeleteInteresting productivity idea for us lawyers. But only if it is automated!
In your spare time do you want to make a visual program where one simply selects folders on the computer and the software measures changes and shows a visual bar for each file? I bet you could sell it.
Chris
Still ahead of the curve, just like at Quarry.
ReplyDeleteDoug: Thanks!
ReplyDeleteBTW, how did you come across my post?