Programming pearls: the back of the envelope
暂无分享,去创建一个
It was in the middle of a fascinating conversation on software engineering that Bob Martin asked me, "How much water flows out of the Mississippi River in a day?" Because I had found his comments up to that point deeply insightful, I politely stifled my true response and said, "Pardon me?". When he asked again I realized that I had no choice but to humor the poor fellow, who had obviously cracked under the pressures of running a large software shop within AT&T Bell Laboratories. My response went something like this. I figured that near its mouth the river was about a mile wide and maybe 20 feet deep (or about one two-hundred-andfiftieth of a mile). I guessed that the rate of flow was five miles an hour, or 120 miles per day. Multiplying 1 x 1/250 x 120 showed that the river discharged about half a cubic mile of water per day, to within an order of magnitude. 1 But so what? At that point Martin picked up a proposal on his desk for the development of a large computer-based mail system, and went through a similar sequence of calculations. Although his numbers were more precise (they were straight from the proposal), the calculations were just as simple and much more revealing. They showed that, under generous assumptions, the proposed system had a chance of working only if there were at least a hundred and twenty seconds in each minute. He had sent the design back to the drawing board the previous day. That was Bob Martin's wonderful (if eccentric) way of introducing the engineering technique of "back-ofthe-envelope" calculations. The technique is standard fare in most engineering curricula, and is bread and butter for practicing engineers in many fields. Unfortunately, it is too often neglected in computing.
[1] Bjarne Stroustrup,et al. C++ Programming Language , 1986, IEEE Softw..
[2] Sandra A. Mamrak,et al. A progress report on the Desperanto research project: software support for distributed processing , 1983, OPSR.
[3] E. P. Quibell. The Physically Handicapped Child , 1979, The Australasian nurses journal.
[4] Peter J. Denning,et al. The Operational Analysis of Queueing Network Models , 1978, CSUR.