内容简介: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》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
利用Python进行数据分析
Wes McKinney / 唐学韬 / 机械工业出版社 / 2013-11-18 / 89.00
【名人推荐】 “科学计算和数据分析社区已经等待这本书很多年了:大量具体的实践建议,以及大量综合应用方法。本书在未来几年里肯定会成为Python领域中技术计算的权威指南。” ——Fernando Pérez 加州大学伯克利分校 研究科学家, IPython的创始人之一 【内容简介】 还在苦苦寻觅用Python控制、处理、整理、分析结构化数据的完整课程?本书含有大量的实践案例,......一起来看看 《利用Python进行数据分析》 这本书的介绍吧!