不是使用硬编码的默认值,程序可以使用用户以前的设置作为默认值,这样更可能是用户所希望的。
Instead of choosing a hard-wired default, the application can use the previous setting as the default, and it will have a much better chance of giving a user what he wanted.
这里的想法就是要避免复制代码以及硬编码。
例如,如果您有五种不同的COBOL数据结构,您将编写五个特定于格式的解析器,并将格式信息硬编码到解析器程序代码中。
For example, if you have five different COBOL data structures, you write five format-specific parsers, with the format information hard-wired into the parser program code.
For instance in the past, we had that silly little program for computing the average of some quizzes and it was actually a pretty bad implementation because I had essentially hard coded in the number of quizzes.
比如在以前,我们做了一个,计算平均数的程序,这是一个相当挫的实现,因为我硬编码了测试的数字。
So I wrote a little program called "chart" that, based on some data I happened to hardcode into the program, shows us their numbers for the past several years.
我写了一个叫做“图表“的小程序,基于我在程序中硬编码的一些数据,向我们显示在过去几年中我们课程的人数。
It's not nearly as graphical but at least we're not hardcoding programs that are otherwise uninteresting.
这可不是绘画,我们至少不是在硬编码程序,那是没有趣味的。
应用推荐