Single Responsibility principle for checkins to source control

This is probably quite an obvious thought, but it occurred to me when trying to review a checkin that was done by someone who just can’t help himself when it comes to cleaning up code. It’s an obsession, so whatever he is doing he can’t help but leave the code a little tidier. Lovely. Except of course when his 10 lines of changes are obscured by the fact that he has deleted dead code from a hundred places in the file. Very hard to review.

So after that, we have a simple rule: if you must clean up, make a “null change” checkin for the cleanup with a comment to match; and another checkin with the fix. Then each checkin has a single responsibility. The mnemonic for the rule is: if you feel like using an “and” in your checkin comment you have probably done it wrong.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s