官术网_书友最值得收藏!

A scary class of bugs

Imagine that you're trying to bake a loaf of bread. Nothing fancy, just a plain loaf. You don't even need to look at the recipe—it's just a handful of ingredients, and you've memorized the steps. Now suppose that one or two of your ingredients have been changed without your knowledge. You still follow the steps, and the end result still looks like bread, but then your family eats it. One family member says something tastes off, another doesn't seem to notice anything, while yet another heads straight for the washroom.

These are just some of many possible scenarios that could have played out, and the problems all stemmed from the ingredients used. In other words, because the ingredients were allowed to change, they did change. Consider the game Telephone. In this game, there is a line of people and a message is whispered to the first person in the line. The same message is whispered (allegedly) to the next person, and so on, until the message reaches the last person who then says the message out loud. The ending message is almost never the same as the starting message. Once again, the message changes because it's allowed to change.

When writing software, you're no different from the person making bread using incorrect ingredients or the Telephone game player relaying an incorrect message. The end result is a scary type of bug. If you mess up your bread, can you pinpoint exactly what went wrong? Can you identify the Telephone game players who broke the message? Your variables change because they can. You've written code to make the variables change, and sometimes everything works exactly as you want it to. But when something goes wrong, it's very difficult to figure out what went wrong.

主站蜘蛛池模板: 宜兰县| 曲松县| 通渭县| 辽宁省| 巢湖市| 雷山县| 曲阜市| 洛宁县| 渑池县| 濮阳市| 老河口市| 兴和县| 镇原县| 冀州市| 汉川市| 嘉峪关市| 大方县| 南平市| 揭东县| 义马市| 银川市| 长寿区| 津南区| 嫩江县| 喜德县| 晋州市| 灵璧县| 吉木萨尔县| 浮梁县| 长垣县| 西吉县| 兴化市| 鹰潭市| 集安市| 贵港市| 响水县| 方山县| 卢氏县| 扎兰屯市| 财经| 乐都县|