KISS

The KISS principle (acronym for "Keep It Simple, Stupid") states that design simplicity should be a key goal and unnecessary complexity avoided. It serves as a useful principle in a wide array of disciplines, such as software development, animation, photography, engineering, and strategic planning. Common variants of the acronym include: "Keep It Sweet & Simple", and "Keep It Short & Simple". The form "Keep It Simple, Silly" is sometimes used in situations (for example, explaining the phrase to children) where "stupid" may be perceived as being too harsh.

Complexity should be avoided—simplicity is a goal in itself. Extra features are not needed; an approach that seems "too easy to be true" is in fact the best way. A very straightforward approach may seem less glamorous and less dramatic, but the trivial approach should indeed be taken. Surprisingly, the very obvious approach is often the best.

代码的主要代价在维护,维护则需要阅读、理解。所以,代码应该写得尽量简单易懂。

你可能感兴趣的:(KISS)