So, we have seen how to reduce an 800-line input to a single line
and even reduce this single line even further to 8 characters
that reproduce the bug.
This is also what the Mozilla volunteers did,
and within one night the first volunteers already had earned their t-shirts.
This is obviously simpler than 800-lines of HTML code,
but what is it that makes something simpler?
Or when do we say that something is simpler than something else?
What is it that makes something simple?
First, there is the burden it takes to understand something.
In debugging, an input that takes me 10 seconds to understand
is simpler than an input that takes me 10 minutes.
This is why one line of HTML is better than 800 lines of HTML,
because the one line of HTML has a far smaller burden to understand
why something went wrong.
Second, the less burden it takes to explain something,
the simpler it is, or maybe the other way around.
If something is simpler, it takes less effort or explain something.
If I say Mozilla cannot print a select tag,
then it is way simpler than saying Mozilla can't print this Bugzilla page
with the following 800 lines of code.
Plus, a short explanation also points me directly to the code in question.
If I know Mozilla can't print a select tag,
I can go directly to the code in which Mozilla handles printing select tags.
All of his, however, refers to humans.
It is the human burden we're talking about.
Things that are simple are easy to explain and easy to understand,
but what is complex to one can be simple to others and vice versa.
The same thing can be explained in simple terms and also in complex terms.
Dunque, abbiamo visto come ridurre un input di 800 righe ad una sola
ed anche a ridurre questa singola riga ulteriormente a 8 caratteri
che riproducano il bug.
Questo e' anche quello che fecereo i volontari di Mozilla
ed in una sola notte i primi volontari si sono guadagnati la maglietta.
Questo e' ovviamente piu' semplice che 800 righe di codice HTML,
ma cos'e' che rende una cosa piu' semplice,
o quando possiamo dire che qualcosa e' piu' semplice di qualcos'altro?
Cosa rende una cosa semplice?
Primo, c'e' la fatca che ci vuole a capire qualcosa.
Facendo debugging un input che ha bisogno di 10 secondi per essere capito
e' piu' semplice di un'altro in cui me ne servono 10.
Ecco perche' una riga di HTML e' meglio di 800 righe,
perche' quella riga richiede una fatica molto minore per capire
cosa e' andato storto.
Secondo, la minor fatica che serve a spiegare qualcosa:
piu' e semplice...anzi, vedendola in un altro modo,
se qualcosa e' piu' semplice richiede meno sforzo per essere spiegata.
Se dico che Mozilla non puo' stampare il tag select,
e' piu' semplice di dire che Mozilla non puo' stampare questa pagina di Bugzilla
con le seguenti 800 righe di codice.
In piu', una breve spigazione mi fa arrivare direttamente al codice in questione.
Se so che Mozilla non puo' stampare il tag select,
posso andare direttamente al codice in cui mozilla gestisce la stampa dei tag select.
Tutto cio', comunque riguarda gli esseri umani,
e' la fatica umana quello di cui stiamo parlando.
Le cose che sono semplici, sono semplici da spiegare e da capire,
ma cio' che e' complicato per alcuni puo' essere semplice per altri e viceversa.
La stessa cosa puo' essere spiegata in termini semplici ed anche in termini complicati.
800行を1行にまで絞る方法を確認しましたね
その1行をバグを再現させる8文字のタグまで
絞ることもできました
最初にこれを成し遂げたボランティアには
その日のうちにTシャツが贈られました
確かにHTMLコードを800行書くより単純ですが
もっと単純にできるでしょうか?
これ以上は単純にできないといつ判断できるでしょう?
単純にする方法は何でしょう?
まず理解するのに負担を強いられます
デバッグでは理解に10秒かかる入力は
10分かかる入力より単純です
つまり800行のHTMLコードよりも
1行の方が適しているということです
1行の方が失敗の原因を突き止めようとする際に
負担がずっと少ないからです
次に説明する負担が小さくなるほど単純になりますが
逆に複雑になることもあり得ます
単純になればなるほど説明する手間が減ります
selectタグを出力できないと言う方が
800行のコードがあるBugzillaのページを
出力できない言うより単純です
そして説明が短ければ
問題のあるコードがすぐに分かります
selectタグを出力できないと分かっていれば
該当するコードだけを確認することができます
これはすべて人間に関することで
人間の負担のことを話しています
単純なものは説明するのも理解するのも簡単ですが
誰かには複雑なことが
別の人には単純ということもあります
物事は単純な言葉でも複雑な言葉でも説明できるのです
好的,我们已经看到了如何将一个800行的输入简化到只剩一行
甚至还可以把这一行简化到只剩下8个字符,
就是这些字符引起的bug。
Mozilla的志愿者们也是这么做的,
只用了一个晚上,第一个获得T- shirt的人就已经诞生了。
这明显,这个比800行HTML代码简单多了,
不过,我们想问,是什么把事物简化了呢?
或者我们什么时候可以认为某个事物比其他的要简单?
是什么让事物简单了?
首先,理解事物也需要一定的代价和成本(burden)。
在调试中,只用10秒就可理解的输入自然
比需要10分钟来理解的输入简单。
所以,1行HTML比800行好多了!
因为理解一行HTML的代价、成本非常小,
可以很容易就知道哪里出错了。
其次,解释事物需要的代价越小,
那这个事物就越简单,而不会反过来。
如果事物比较简单,也就可以少花努力来解释了。
如果我说Mozilla无法打印一个select标签,
肯定比说Mozilla无法打印Bugzilla页面简单,
那个页面就有800行代码了。
另外,简短的解释同样可以直指问题所在代码部分。
如果我知道Mozilla不能打印select标签,
我可以直接找到Mozilla中处理打印select标签的代码部分。
然而,上面指的都是人们,或者说程序员。
我们讨论的是人的成本、代价。
简单的事物易于解释,也容易理解,
但复杂的是从一个转到另一个,反过来也复杂。
同一事物可以用简单的词汇来解释,也可以用复杂的术语来说明。