Creating Simplified Code Generators in VS.NET 2003
In this article I would like to talk about a concrete way that you can become a super productive programmer. In Frederick Brooks' book the Mythical Man Month (Addison-Wesley, 1995) Brooks refers to Sackman, Erikson, and Grant's paper "Exploratory experimental studies comparing online and offline programming performance" published in the Communications of the ACM (CACM, 1968) detailing productivity differences between the least and most productive programmers. In the original paper Brooks talks about productivity differences of up to 10-to-1. Although the original material appeared in the 1968 paper, these possible differences are astounding. I firmly believe they exist, and more, I believe productivity differences may be significantly greater than 10-to-1 in some cases. Let me explain by telling you a quick anecdotal story.
During the late 80s I sold mutual funds and insurance. By cold calling I stumbled upon a mother and son that were on the verge of bankruptcy. As it turns out the mother had purchased a whole life insurance product about 40 years prior with a $10,000 death benefit and had purchased several more over the ensuing years. She had been paying monthly premiums for so long—and still was—that the cash value exceeded the death benefit. Living on a fixed income of about $400 per month, the premium for the combined whole life products was in excess of $200 per month, leaving the mother and son a scanty $200 a month to live on. Had their home not been paid in full, I assume they would have been homeless (although to this day I don't know how the taxes on the property were being paid). I explained to the mother that the combined cash value of the policies—there were three of four—was about $30,000 to $50,000, meeting or exceeding the death benefit. By convincing this mother to cash out the policies she still had the same total death benefit, the cash, and could earn interest on the money in the mean time. (You might recall that in the mid-eighties there were securities yielding double digits.) To sum up, the mother no longer had to pay the premiums and had many thousands of dollars earning dividends, netting an additional $200 in available funds not paid to the insurance company and another $300 in interest. The result, a monthly income of $200 became $700 and there would still be the same considerable monies available for the son in the future.
Aside from being proud of that effort, the upshot is that the exact same total resources appropriately reallocated had a dramatic impact on this family's fortune. I believe it is possible to achieve an even more dramatic and positive impact on one's productivity simply by how one's available time is allocated. The key to hyper-productivity is in finding those levers and fulcrums that help orchestrate periods of optimal productivity. Some times this may mean using tools. Other times one may achieve optimal, or hyper-productivity, by knowing what tasks to skip or finding pre-existing solutions, and finally, one may achieve maximum productivity by automating error prone and tedious tasks. Accumulatively, gains made by reusing solutions, skipping unnecessary tasks, and automation will result in a very high rate of output.
In this article I would like to introduce you to a means of turning up your productive output by demonstrating how to use macros in VS.NET to write simplified code generators. The productivity increase is achieved in two ways: the first is that the code generator writes more code in a dramatically shorter period of time than a person can write, and second, once the generator is perfected the generated code is perfect every time, yielding savings in finding syntax errors and bugs. This one modest strategy can significantly speed up code output.