The Beauty of Software

The Beauty of Software

——Robert C. Martin's foreword for Agile Software Development Chinese Version

     Next to my family, software is my passion. It is a medium in which I try to create beauty. The beauty of software is in it's function, in it's internal structure, and in the way in which it is created by a team. To a user, a program with just the right features presented through an intuitive and simple interface, is beautiful. To a software designer, an internal structure that is partitioned in a simple and intuitive manner, and that minimizes internal coupling, is beautiful. To developers and managers, a motivated team of developers making significant progress every week, and producing defect-free code, is beautiful. There is beauty on all these levels, and they are all part of the topic of this book.
     How do software developers learn how to create this beauty? In this book I teach the principles, patterns, and practices that can help software developers take the first steps towards beautiful programs, designs, and teams. In these pages we explore basic design principle, common patterns in the structure of a software design, and a set of practices that can help a team knit itself into a functioning whole. Since this book is about software development, it contains a lot of code. The principles, patterns, and practices that this book teaches are learned most effectively by carefully studying that code.
     Our world needs software -- lots of software. Fifty years ago software was something that ran in a few big and expensive machines. Thirty years ago it was something that ran in most companies and industrial settings. Now there is software running in our cell phones, watches, appliances, automobiles,toys, and tools. And need for new and better software never stops. As our civilization grows and expands, as developing nations build their infrastructures, as developed nations strive to achieve ever greater efficiencies, the need for more and more software continues to increase. It would be a great shame if, in all that software, there was no beauty.
     We know that software can be ugly. We know that it can be hard to use,unreliable, and carelessly structured. We know that there are software systems whose tangled and careless internal structures make them expensive and difficult to change. We know that there are software systems that present their features through an awkward and cumbersome interface. We know that there are software systems that crash and misbehave. These are ugly systems. Unfortunately, as a profession, software developers tend to create more ugly systems than beautiful ones. If you are reading this book, then you are someone who wants to create beauty and not ugliness.
     There is a secret that the best software developers know. Beauty is cheaper than ugliness. Beauty is faster than ugliness. A beautiful software system can be built and maintained in less time, and for less money, than an ugly one. Novice software developers don't understand this. They think that they have to do everything fast and quick. They think that beauty is impractical. No! By doing things fast and quick, they make messes that make the software stiff, and hard to understand. Beautiful systems are flexible and easy to understand. Building them and maintaining them is a joy. It is ugliness that is impractical. Ugliness will slow you down and make your software expensive and brittle. Beautiful systems cost the least to build and maintain, and are delivered soonest.
     I hope you enjoy this book. I hope you learn to take as much pride and joy in the creation of beautiful software that I do. If this book can show you just an inkling of that joy, motivate you to feel just the beginnings of that pride, and provide just a spark of appreciation for that beauty, then it has more than accomplished my goal for it.

 

  

《软件之美》(Robert C. Martin为清华版《敏捷软件开发:原则、模式与实践》中文版序)

      除了我的家庭,软件是我的挚爱。通过它,我可以创造出美的东西。软件之美在于它的功能,在于它的内部结构,还在于团队创建它的过程。对用户来说,通过直观、简单的界面呈现出恰当特性的程序就是美的。对软件设计者来说,被简单、直观地分割,并具有最小内部耦合的内部结构就是美的。对开发人员和管理者来说,每周都会取得重大进展,并且生产出无缺陷代码的具有活力的团队就是美的。美存在于所有这些层次之中,它们都是本书内容的一部分。
      软件开发人员如何学到创造美的知识呢?在本书中,我讲授了一些原则、模式以及实践,它们可以帮助软件开发人员在追求美的程序、设计以及团队的道路上迈出第一步。其中,我们探索了基本的设计原则,软件设计结构的通用模式以及有助于团队融为一个有机整体的一系列实践。由于本书是关于软件开发的,所以包含了许多代码。仔细研究这些代码是学习本书所教授的原则、模式以及实践的最有效方法。
      人们需要软件--需要许多的软件。50年前,软件还只是运行在少量大型、昂贵的机器之上。30年前,软件可以运行在大多数公司和工业环境之中。现在,移动电话、手表、电器、汽车、玩具以及工具中都运行有软件,并且对更新、更好软件的需求永远不会停止。随着人类文明的发展和壮大,随着发展中国家不断构建它们的基础设施,随着发达国家努力追求更高的效率,就需要越来越多的软件。如果在所有这些软件之中,都没有美存在,这将会是一个很大的遗憾。
      我们知道软件可能会是丑陋的。我们知道软件可能会难以使用、不可靠并且是粗制滥造的;我们知道有一些软件系统,其混乱、粗糙的内部结构使得对它们的更改既昂贵又困难;我们还见过那些通过笨拙、难以使用的界面展现其特性的软件系统;我们同样也见过那些易崩溃且行为不当的软件系统。这些都是丑陋的系统。糟糕的是,作为一种职业,软件开发人员所创建出来的美的东西却往往少于丑的东西。如果你正在阅读这本书,那么你也许就是那个想去创造美而不是丑的人。
      最好的软件开发人员都知道一个秘密:美的东西比丑的东西创建起来更廉价,也更快捷。构建、维护一个美的软件系统所花费的时间、金钱都要少于丑的系统。软件开发新手往往不理解这一点。他们认为做每件事情都必须要快,他们认为美是不实用的。错!由于事情做得过快,他们造成的混乱致使软件僵化,难以理解。美的系统是灵活、易于理解的,构建、维护它们就是一种快乐。丑陋的系统才是不实用的。丑陋会降低你的开发速度,使你的软件昂贵而又脆弱。构建、维护美的系统所花费的代价最少,交付起来也最快。
      我希望你能喜爱这本书。我希望你能像我一样学着以创建美的软件而骄傲,并享受其中的快乐。如果你从本书中略微看到了这种快乐,如果本书使你开始感受到了这种骄傲,如果本书点燃了你内心欣赏这种美的火花,那么就远超过我的目标了。
(邓辉译)


你可能感兴趣的:(software)