What does this code do?
От: monax  
Дата: 04.08.11 09:32
Оценка:
Статья о контексте, в котором обсуждается тот или иной код и насколько может быть трудно без него What does this code do?

At the SciPy 2010 conference, a speaker showed several short code samples and asked us what each sample did. The samples were clearly written, but we had no comments to provide context. This was the last sample.

def what( x, n ):
    if n < 0:
        n = -n
        x = 1.0 / x
    z = 1.0
    while n > 0:
        if n % 2 == 1:
            z *= x
        x *= x
        n /= 2
    return z


И ещё:

Now suppose you’re a contractor on the opposite side of the world from Sam. You have even less context than if you were in his office talking to his office mate. After a great deal of agony, you send your contribution back to Sam’s company. You comment your code beautifully, but Sam’s colleagues complain that your code is poorly written and that you didn’t solve the right problem.

Institutional memory is more valuable than source code comments. It costs a great deal to replace a programmer, even one who leaves behind well-commented code.


Собственно в статье описаны причины, почему компаниям с долгоиграющими проектами невыгодна высокая текучка кадров. Вроде бы и прописные истины, но прочесть один раз не вредно.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.