Throwaway Code

栏目: IT技术 · 发布时间: 4年前

内容简介:Sometimes we write code that we know will be thrown away - especially in the discovery phase of a feature or product. The problem is, often circumstances cause this sort of code to be shipped. I imagine a fair amount of cursing under one's breath the previ

Sometimes we write code that we know will be thrown away - especially in the discovery phase of a feature or product. The problem is, often circumstances cause this sort of code to be shipped. I imagine a fair amount of cursing under one's breath the previous developer who worked on code could be the result of this sort of situation. Writing throwaway code is not necessarily a bad thing though. There may be many layers beneath the final product on a painter's canvas, just as a finished novel or script has had entire sections thrown out or rewritten. What we want to avoid is unmaintainable code (which was knowingly written as such) getting forced out the door once a decision maker sees that "it's working."

In his book, Game Programming Patterns , Robert Nystrom makes a wonderful suggestion on defending against this scenario in the case of building prototypes.

One trick to ensuring your prototype code isn't obliged to become real code is to write it in a language different from the one your game uses. That way, you have to rewrite it before it can end up in your actual game.

Regardless of the method used, he notes that we should "make sure the people using throwaway code understand that even though it kind of looks like it works, it cannot be maintained and must be rewritten."


以上所述就是小编给大家介绍的《Throwaway Code》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

订阅

订阅

[美] 罗伯特·金奇尔、马尼·佩伊万 / 中信出版集团 / 2018-12 / 68.00元

数据显示,年轻人现在每天看视频的时间已经超过电视。YouTube 平台每天的视频观看总时长超过10亿小时,这个数字还在增长。数字视频牢牢占据着人们的注意力。 数字时代如何实现创意变现?视频平台如何提升自己的品牌认知和广告号召力?想要在这个庞大的媒体生态中占据流量入口,你需要先了解 YouTube。在过去的10年里,互联网视频平台 YouTube 已经像60多年前的电影、广播和电视的发明一样,......一起来看看 《订阅》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试