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

Part Three. Simplicity and Software Design

Chapter 9. Design from the Start

You really need to design from the start. You need to be working on simplicity from the very beginning of your project.

My policy on projects that I control is that we never add a feature unless the design can support it simply.

This drives some people crazy, notably people who have no concept of the future. They start to foam at the mouth and say things like, "We can't wait! This feature is so important!" or "Just put it in now and we'll just clean it up later!" They don't realize that this is their normal attitude. They're going to say the same thing about the next feature.

If you don't think about the future, then all of your code will be poorly designed and much too complex.

It'll be Frankenstein's monster, jammed together out of broken parts. And just like the friendly green giant, it'll be big, ugly, unstable, and harmful to your health.

Now just adding a tiny little piece and refactoring it afterward is fine. Landing a huge feature that the architecture can't support and then trying to clean it up afterward is a terrible task. Size matters.

Starting the Right Way

The worst situation is when you let people keep adding features with no design for months or years, and then one day you wake up and realize that something is not right. Now you have to fix your whole codebase. This is a terrible task, because just like adding a new feature, it can't be done all at once, unless you want to re-write.

If you want to start doing things the right way, you have to start doing things the right way. And that means that you have to fix the design piece by piece, in simple steps. That usually requires months or years of effort – totally wasted effort, because you should have just designed from the start. You should have thought about the future.

If your project lacks a strict design, and it continues to grow, then you will eventually end up over your head in complexity.

This doesn't mean you should be designing some huge generic beast from the start that tries to anticipate all future requirements and implement them now. It means that you need to apply the principles of software design as discussed in this book and Code Simplicity so that you get a system that is understandable, simple, and maintainable from the start.

-Max

主站蜘蛛池模板: 永安市| 宝丰县| 崇左市| 平远县| 冷水江市| 永济市| 荆州市| 安丘市| 夹江县| 铁岭市| 长沙县| 石城县| 灵台县| 晋中市| 铜梁县| 西华县| 马边| 新郑市| 府谷县| 富川| 古田县| 永登县| 北宁市| 奉新县| 安远县| 宣威市| 肃宁县| 靖江市| 永年县| 临朐县| 建阳市| 余干县| 芦山县| 资中县| 时尚| 绥棱县| 隆尧县| 松桃| 四会市| 开阳县| 长宁区|