首页 > 代码库 > Code Simplicity–The Science of Software Development 书摘
Code Simplicity–The Science of Software Development 书摘
Chapter1 Introduction
That is the art and talent involved in programming—reducing complexity to simplicity.
A “bad programmer” is just somebody who fails to reduce the complexity.
So, a “good programmer” should do everything in his power to make what he writes as simple as possible to other programmers. A good programmer creates things that are easy to understand, so that it’s really easy to shake out all the bugs.
The phrase “a computer program,” in the way that most people use it, has two verydistinct definitions:
1. A sequence of instructions given to the computer
2. The actions taken by a computer as the result of being given instructions
The first definition is what programmers see when they are writing a program. The second definition is what users see when they are using a program. The programmer tells the computer, “Display a pig on the screen.” That’s definition 1, some instructions. The computer pushes around a lot of electricity that causes a pig to appear on the screen. That’s definition 2, the actions taken by the computer. Both the programmer and the user here would say that they are working with “a computer program,” but their experience of it is very different. Programmers work with the words and symbols, while users see only the end result—the actions taken.
感悟:程序员容易陷入自己的惯性思维中,要多站在用户的角度上思考问题,这样设计出的东西才更受欢迎。这里的两个定义非常形象的描述了程序员和用户看待同一程序的截然不同的两个角度。
CHAPTER 2 The Missing Science
Every programmer working on a software project is involved in design. The lead developer is in charge of designing the overall architecture of the entire program. The senior programmers are in charge of designing their own large areas. And the junior programmers are in charge of designing their parts of the program, even if they’re as simple as one part of one file. There is even a certain amount of design involved in writing a single line of code.
A designer should always be willing to listen to suggestions and feedback, because programmers are usually smart people who have good ideas. But after considering all the data, any given decision must be made by an individual, not by a group of people.
CHAPTER 3 The Driving Forces of Software Design
Well, there is in fact a single purpose for all software: To help people.
What about software that helps animals or plants? Well, its purpose is really to help people help animals or plants.
People who cannot conceive of helping another person will write bad software—that is, their software won’t help people very much.
In general, this purpose—to help people—is the most important thing to keep in mind when designing software, and defining it allows us now to create and understand a real science of software design.
The goals of a science of software design:
- To allow us to write software that is as helpful as possible.
- To allow our software to continue to be as helpful as possible.
- To design systems that can be created and maintained as easily as possible by their programmers, so that they can be—and continue to be—as helpful as possible.
One thing that’s important to point out about this third goal is the phrase “as easily as possible.” The idea is to make our programs easy to create and maintain, not to make them difficult or complex.
CHAPTER 4 The Future
待续。。。