Esta página dá as traduções das epígrafes nos capítulos do livro Algoritmos em Linguagem C.
Informatica gaat net zo min over computers als astronomie over telescopen.
Computer science is no more about computers
than astronomy is about telescopes.
[Edsger W. Dijkstra]
Ciência da computação não é a ciência dos computadores,
assim como a astronomia não é a ciência dos telescópios.
Programming is best regarded as the process of creating works of literature, which are meant to be read.[Donald E. Knuth, Literate Programming]
A atividade de programação deve ser encarada
como um processo de criação de obras de literatura,
escritas para serem lidas.
Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us imagine that our main task is to explain to human beings what we want a computer to do.[Donald E. Knuth, Literate Programming]
Devemos mudar nossa atitude tradicional
em relação à construção de programas.
Em vez de imaginar que nossa principal tarefa é instruir o computador sobre o que
ele deve fazer,
vamos imaginar que nossa principal tarefa é explicar a seres humanos
o que queremos que o computador faça.
Needless to say [that] all by itself, a program is no more than half a conjecture. The other half of the conjecture is the functional specification the program is supposed to satisfy. The programmer's task is to present such complete conjectures as proven theorems.[Edsger W. Dijkstra, manuscrito EWD1036]
Não é preciso dizer que
um programa não é mais que meia conjetura.
A outra metade da conjetura
é a especificação funcional que o programa supostamente satisfaz.
A tarefa do programador
é a de apresentar tais conjeturas completas como como teoremas
demonstrados.
Programs must be written for people to read, and incidentally for machines to execute.[H. Abelson, G. Sussman, The Structure and Interpretation of Computer Programs]
Programas devem ser escritos para serem lidos por seres humanos e,
incidentalmente,
para serem executados por máquinas.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.[Martin Fowler, Refactoring: Improving the Design of Existing Code]
Qualquer idiota é capaz de escrever código que um
computador possa entender.
Bons programadores escrevem código que seres humanos podem entender.
… put a comment on each function saying what the function does, what sorts of arguments it gets, and what the possible values of arguments mean and are used for […] Also explain the significance of the return value, if there is one.[Seção Commenting Your Work em GNU Coding Standards]
… acrescente um comentário a cada função para dizer
o que a função faz,
que tipo de argumentos recebe,
o que cada um dos possíveis valores dos argumentos significa.
[…]
Se a função devolve algo,
explique o significado do valor devolvido.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.[Brian W. Kernighan]
Encontrar erros em programas
é duas vezes mais difícil que escrever o código.
Portanto,
se você escrever o código da maneira mais esperta que puder,
você não será
suficientemente esperto para encontrar os erros.
A good algorithm is like a sharp knife: it does what it is supposed to do with a minimum amount of applied effort. Using the wrong algorithm to solve a problem is like trying to cut a steak with a screwdriver: you may eventually get a digestible result, but you will expend considerably more effort than necessary, and the result is unlikely to be aesthetically pleasing.[Th. Cormen, Ch. Leiserson, R. Rivest, Introduction to Algorithms]
Um bom algoritmo é como uma faca afiada:
ele faz o que dele se espera com o mínima de esforço.
Usar um algoritmo errado para resolver um problema
é como tentar cortar um bife com uma chave de fenda:
você pode até mesmo conseguir um resultado aceitável,
mas você gastará muito mais esforço que o necessário
e é pouco provável que o resultado será esteticamente agradável.
There is a huge difference between programs that merely work and programs that are well-engineered, just as there is a huge difference between a log thrown over a river and a well-engineered bridge. […] There is a huge difference between working programs and good programs. A good program not only works, but is easy to read and maintain.[P. A. Darnell, Ph. E. Margolis, Software Engineering in C]
Há uma enorme diferença entre programas que meramente funcionam
e programas bem construídos,
assim como há uma enorme diferença entre um tronco
atravessado sobre um rio e uma ponte bem construída.
[…]
Há uma enorme diferença entre programas que funcionam
e bons programas.
Um bom programa não só funciona, mas é fácil de ler e de manter.
To understand recursion, we must first understand recursion.[Anônimo]
Para entender recursão, é preciso primeiro entender recursão.
Binary search is to algorithms what a wheel is to mechanics: It is simple, elegant, and immensely important.[Udi Manber, Introduction to Algorithms]
Busca binária é para algoritmos
o que a roda é para a mecânica:
ela é simples, elegante, e enormemente importante.
Binary search is a notoriously tricky algorithm to program correctly. It took seventeen years after its invention until the first correct version of binary search was published![Steven Skiena, The Algorithm Design Manual]
Busca binária é um algoritmo notoriamente difícil
de programar corretamente.
Somente dezessete anos depois da invenção do algoritmo
a primeira versão correta
do programa foi publicada!
Often it appears that there is no better way to solve a problem than to try all possible solutions. This approach, called exhaustive search, is almost always slow, but sometimes it is better than nothing.[Ian Parberry, Problems on Algorithms]
Muitas vezes
não há maneira melhor de resolver um problema
que tentar todas as possíveis soluções.
Esta abordagem, chamada busca exaustiva,
é quase sempre lenta,
mas às vezes ela é melhor que nada.