Skip to content

Commit a07653e

Browse files
committed
Merge pull request braydie#6 from braydie/master
merge master
2 parents ed0cea2 + 86d46df commit a07653e

File tree

6 files changed

+19
-8
lines changed

6 files changed

+19
-8
lines changed

en/1-Beginner/Personal-Skills/02-How to Debug by Splitting the Problem Space.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Suppose, for example, you created a program that should do ten things in a seque
66

77
Can you design an experiment to see which thing it crashed on? Sure. You can use a debugger or we can add printline statements (or the equivalent in whatever language you are working in) after #8 and #9. When we run it again, our mystery will be smaller, such as ‘It crashed on thing #9.’ I find that bearing in mind exactly what the mystery is at any point in time helps keep one focused. When several people are working together under pressure on a problem it is easy to forget what the most important mystery is.
88

9-
The key to divide and conquer as a debugging technique is the same as it is for algorithm design: as long as you do a good job splitting the mystery in the middle, you won't have to split it too many times, and you will be debugging quickly. But what is the middle of a mystery? There is where true creativity and experience comes in.
9+
The key to divide and conquer as a debugging technique is the same as it is for algorithm design: as long as you do a good job splitting the mystery in the middle, you won't have to split it too many times, and you will be debugging quickly. But what is the middle of a mystery? This is where true creativity and experience comes in.
1010

1111
To a true beginner, the space of all possible errors looks like every line in the source code. You don't have the vision you will later develop to see the other dimensions of the program, such as the space of executed lines, the data structure, the memory management, the interaction with foreign code, the code that is risky, and the code that is simple. For the experienced programmer, these other dimensions form an imperfect but very useful mental model of all the things that can go wrong. Having that mental model is what helps one find the middle of the mystery effectively.
1212

en/1-Beginner/Personal-Skills/10-How to Deal with Intermittent Bugs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The intermittent bug is a cousin of the 50-foot-invisible-scorpion-from-outer-space kind of bug. This nightmare occurs so rarely that it is hard to observe, yet often enough that it can't be ignored. You can't debug because you can't find it.
44

5-
Although after 8 hours you will start to doubt it, the intermittent bug has to obey the same laws of logic everything else does. What makes it hard is that it occurs only under unknown conditions. Try to record the circumstances under which the bug does occur, so that you can guess at what the variability really is. The condition may be related to data values, such as ‘This only happens when we enter *Wyoming* as a value.’ If that is not the source of variability, the next suspect should be improperly synchronized concurrency.
5+
Although after 8 hours you will start to doubt it, the intermittent bug has to obey the same laws of logic everything else does. What makes it hard is that it occurs only under unknown conditions. Try to record the circumstances under which the bug does occur, so that you can guess what the variability really is. The condition may be related to data values, such as ‘This only happens when we enter *Wyoming* as a value.’ If that is not the source of variability, the next suspect should be improperly synchronized concurrency.
66

77
Try, try, try to reproduce the bug in a controlled way. If you can't reproduce it, set a trap for it by building a logging system, a special one if you have to, that can log what you guess you need when it really does occur. Resign yourself to that if the bug only occurs in production and not at your whim, this may be a long process. The hints that you get from the log may not provide the solution but may give you enough information to improve the logging. The improved logging system may take a long time to be put into production. Then, you have to wait for the bug to reoccur to get more information. This cycle can go on for some time.
88

en/1-Beginner/Team-Skills/02-How to Estimate Programming Time.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ When not possible to take the time for some investigation, you should first esta
1010

1111
I know good engineers who pad estimates implicitly, but I recommend that you do not. One of the results of padding is trust in you may be depleted. For instance, an engineer might estimate three days for a task that she truly thinks will take one day. The engineer may plan to spend two days documenting it, or two days working on some other useful project. But it will be detectable that the task was done in only one day (if it turns out that way), and the appearance of slacking or overestimating is born. It's far better to give proper visibility into what you are actually doing. If documentation takes twice as long as coding and the estimate says so, tremendous advantage is gained by making this visible to the manager.
1212

13-
Pad explicitly instead. If a task will probably take one day - but might take ten days if your approach doesn't work - note this somehow in the estimate if you can; if not, at least do an average weighted by your estimates of the probabilities. Any risk factor that you can identify and assign an estimate to should go into the schedule. One person is unlikely to be sick in any given week. But a large project with many engineers will have some sick time; likewise vacation time. And what is the probability of a mandatory company-wide training seminar? If it can be estimated, stick it in. There are of course, unknown unknowns, or *unk-unks*. Unk-unks by definition cannot be estimated individually. You can try to create a global line item for all unk-unks, or handle them in some other way that you communicate to your boss. You cannot, however, let your boss forget that they exist, and it is devilishly easy for an estimate to become a schedule without the unk-unks considered.
13+
Pad explicitly instead. If a task will probably take one day - but might take ten days if your approach doesn't work - note this somehow in the estimate if you can; if not, at least do an average weighted by your estimates of the probabilities. Any risk factor that you can identify and assign an estimate to, should go into the schedule. One person is unlikely to be sick in any given week. But a large project with many engineers will have some sick time; likewise vacation time. And what is the probability of a mandatory company-wide training seminar? If it can be estimated, stick it in. There are of course, unknown unknowns, or *unk-unks*. Unk-unks by definition cannot be estimated individually. You can try to create a global line item for all unk-unks, or handle them in some other way that you communicate to your boss. You cannot, however, let your boss forget that they exist, and it is devilishly easy for an estimate to become a schedule without the unk-unks considered.
1414

1515
In a team environment, you should try to have the people who will do the work do the estimate, and you should try to have team-wide consensus on estimates. People vary widely in skill, experience, preparedness, and confidence. Calamity strikes when a strong programmer estimates for herself and then weak programmers are held to this estimate. The act of having the whole team agree on a line-by-line basis to the estimate clarifies the team understanding, as well as allowing the opportunity for tactical reassignment of resources (for instance, shifting burden away from weaker team members to stronger).
1616

1717
If there are big risks that cannot be evaluated, it is your duty to state so forcefully enough that your manager does not commit to them and then become embarrassed when the risk occurs. Hopefully in such a case whatever is needed will be done to decrease the risk.
1818

1919
If you can convince your company to use *Extreme Programming*, you will only have to estimate relatively small things, and this is both more fun and more productive.
2020

21-
Next [How to Find Out Information](03-How to Find Out Information.md)
21+
Next [How to Find Out Information](03-How to Find Out Information.md)

en/2-Intermediate/Personal-Skills/03-How to Tradeoff Time vs Space.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In designing or understanding an algorithm, the amount of time it takes to run i
66

77
To me, computational complexity theory is beautiful and as profound as physics - and a little bit goes a long way!
88

9-
Time (processor cycles) and space (memory) can be traded off against each other. Engineering is about compromise, and this is a fine example. It is not always systematic. In general, however, one can save space by encoding things more tightly, at the expense of more computation time when you have to decode them. You can save time by caching, that is, spending space to store a local copy of something, at the expense of having to maintain the consistency of the cache. You can sometimes save time by maintaining more information in a data structure. This usually cost a small amount of space but may complicate the algorithm.
9+
Time (processor cycles) and space (memory) can be traded off against each other. Engineering is about compromise, and this is a fine example. It is not always systematic. In general, however, one can save space by encoding things more tightly, at the expense of more computation time when you have to decode them. You can save time by caching, that is, spending space to store a local copy of something, at the expense of having to maintain the consistency of the cache. You can sometimes save time by maintaining more information in a data structure. This usually costs a small amount of space, but may complicate the algorithm.
1010

1111
Improving the space/time trade-off can often change one or the other dramatically. However, before you work on this you should ask yourself if what you are improving is really the thing that needs the most improvement. It's fun to work on an algorithm, but you can't let that blind you to the cold hard fact that improving something that is not a problem will not make any noticeable difference and will create a test burden.
1212

en/7-Contributions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ There are a number of ways to contribute to "How to be a Programmer".
1010
- Identifying typos or other issues in sections
1111
- Contributing additional links to resources for sections
1212
- General suggestions for improving the project
13+
- Provide translations of the guide
14+
15+
## Translations
16+
17+
Currently this guide has been translated from English into the following languages:
18+
19+
- Chinese by [ahangchen](https://github.com/ahangchen)
20+
21+
**If you provide the initial translation of the guide into another language, you become legible to become a contributor on this project to help maintain and review changes made to the translation.**
1322

1423
## Contributors
1524

zh/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ Copyright 2002, 2003, 2016 Robert L. Read
55

66
Licensed under [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/).
77

8-
翻译:[梦里风林](https://github.com/ahangchen/How-to-Be-A-Programmer-CN)
8+
翻译:[梦里风林](https://github.com/ahangchen)
99

1010
原文:[HowToBeAProgrammer](https://github.com/braydie/HowToBeAProgrammer)
1111

12-
如果您希望改进这份中文翻译,请向这个[分支](https://github.com/ahangchen/HowToBeAProgrammer)提交Pull request.
12+
如果您希望改进这份中文翻译,请向这个[分支](https://github.com/ahangchen/HowToBeAProgrammer)提交Pull request。
13+
14+
[可以在gitbook在线阅读或导出PDF。](https://braydie.gitbooks.io/how-to-be-a-programmer/content/zh/index.html)
1315

1416
文章中出现的一些词汇往往有特殊的含义,可以在[4-词汇表](4-Glossary.md)找到注释。
1517

1618
## 引言
17-
  做一个好的程序员,困难而高尚。将一个软件工程集体愿景变为现实,最困难的地方在于与你的同事和顾客相处。编程很重要,这需要强大的智力和技能。 但在好的程序员看来,相比构建一个让客户和各种各样的同事都满意的软件系统,(纯粹的)编程真的只是小孩子的玩意。在这篇文章里,我尝试尽可能简洁地总结那些当我21岁时,希望别人告诉我的事。
19+
  做一个好的程序员困难而高尚。将一个软件工程集体愿景变为现实,最困难的地方在于与你的同事和顾客相处。编程很重要,这需要强大的智力和技能。 但在好的程序员看来,相比构建一个让客户和各种各样的同事都满意的软件系统,(纯粹的)编程真的只是小孩子的玩意。在这篇文章里,我尝试尽可能简洁地总结那些当我21岁时,希望别人告诉我的事。
1820

1921
  这可能很主观的,所以,这篇文章注定不适用于所有人,并且有的内容有点武断。我尽量写一些程序员在ta的工作中,非常可能会遇到的事情。大部分这些问题以及它们的解决方案在人们的环境中如此普遍,以至于我(说的)可能有点唠叨。尽管如此,我还是希望这篇文章是有用的。
2022

0 commit comments

Comments
 (0)