Priorities for writing code
I've been following SO for a while now, and every so often I see people asking about the fastest way to do something. I certainly acknowledge that code must be well written and even tuned every now and then, but in my everyday work I am much more concerned about maintainability of code and only occasionally do I actually have to tune code to make it go faster.
Therefore I would like to know what priorities others are following when writing code. So in other words: What are the most important attributes of the code? And as a follow-up questions I would like to know who made this decision (management or developers)?
Code must perform its intended task in a time period short enough to be usable. This varies widely between applications. Striving to make your code "fast" when you fail to understand how fast it needs to be is a waste of time; at the same time, striving to make your code "maintainable" when you lack a clear, high-level idea of what your code is meant to accomplish is doomed to failure. Therefore, top priority must be given to understanding the problem you wish to solve; everything else follows from this understanding.
See also: When is optimisation premature?
mdbritt's answer is pretty close to my attitude, but a few other things:
Software Quality should be on the top of every code-writing priority list...
上一篇: 何时使用Enum / Int常量
下一篇: 编写代码的优先级