Mom always said, don't play ball in the house (and other good coding guidelines) | Cypress Semiconductor
Mom always said, don't play ball in the house (and other good coding guidelines)
Mother's day has come and past again, and yet again I have unfinished work to do. Since my mom does not get to Cypress blogs very often, I can tell you the details. I have a silver locket for her, and of course that would not be enough, since lockets are meant to hold pictures, and as it is my gift to my mother it would seem that I should include a picture of me. But there are two sides to the locket and what goes in the other side? Another picture of me? Perhaps, but unexciting. (What's worse than a locket with my picture in it? A locket with 2 pictures of me.) Perhaps a picture of her son and her granddaughter. Not a bad idea, so now get on it. Thus the unfinished business. (I did call here to tell her it was coming.)
But that got me to thinking about the role mothers have on our behavior. Mothers always have sayings, directions, commands that they use ad infinitum (although we kids can hear it 100s of times and still not do it). Things like: wait a half hour before swimming, rinse the dishes before putting them in the dishwasher, don't use my good scissors for that, no rough-housing in the living room (I can't imagine anyone but my mom saying "rough-housing").
Then there is the world famous "don't play ball in the house". As a father, I find myself only sometimes telling these things to my daughter (but I do hear her mother say things like that) and I still find myself after all these years breaking these rules. For instance, I will kick a soccer ball around with my daughter in the family room where there are vases, flower arrangements, glass snowglobes, etc. well within striking distance. I usually only say the famous line after my daughter or I has just swiped the ball past the vase for a near miss. Even then I may only say "keep the ball on the floor, no air".
So while I do not live by the letter of these "rules" drilled into me by my mother, they definitely affect my behavior and come to mind when something goes wrong. Much like a good set of coding guidelines. They encourage a safe and comfortable way of life, and but we need to be reminded of them. When the list of rules and their particulars gets long and involved, the behavior influencing becomes muted - how can 45 or more line items truly be internalized. Coding checklists very often are this way, long and detailed and rarely support the flow of a review through the program. Coding checklists are meant to be used to check what has already been done, not to direct ongoing behavior. Coding guidelines on the other hand are meant to direct good behavior, and reinforce it, so that when your buddy reviews your code the checklist helps him pick up the things you (and he) missed. Checklists are important, but they do not teach good behavior, they catch bad behavior.
Unless the checklist is actionable and integrated into the everyday workflow. Before every flight, a pilot will pull out his checklist and go over all the same things he has hundreds of times before, knowing that doing so may save his life. If he didn't have the checklist but instead did his best and then asked someone else (manager or wife) to "check him out" for the flight, there is a good a chance someone might miss something, unless he or she uses a checklist. Is it possible to get our coding checklists to this level, where they help us in day-to-day workflow? Or to make our code review checklists flow efficiently like a pilot's preflight checklist? If we treat it that way, yes it can. And if the checklist is not efficient and does not flow like a pilots, then the coding guidelines must be much stronger and more behavior influencing.
So next year when I am shopping for a great mother's day gift, a new checklist item for me before buying it is whether it is ready to ship or if additional "assembly" will be required. And on my new guidelines for indoor soccer with Adrienna I add don't play ball in the house when mom is home. And keep some good glue handy.