2015-08-20 14:47 GMT+02:00 enrico franchi <enrico.fran...@gmail.com>:
> > 2015-08-20 10:24 GMT+01:00 orciml <orc...@gmail.com>: > >> il link del nuovo blog è il seguente: >> >> orcim.github.io >> > > Mi sono permesso di lasciarti un commento... > Cito qui quello che dice Enrico: *"In generale, non e' vero che commentare *molto* sia una buona idea. L'idea buona e' rendere necessario commentare poco. I commenti storicamente finiscono fuori sincrono con il codice, specialmente quelli ridondanti e poco utili".* Devo dire che anche io, una volta, pensavo che i commenti fossero necessari e più ce n'erano meglio era. Poi lessi questa frase nel libro Clean Code: *"The proper use of comments is to compensate for our failure to express ourself in code. Comments are always failures. We must have them because we cannot always figure out how to express ourselves without them, but their use is not a cause for celebration. So when you find yourself in a position where you need to write a comment, think it through and see whether there isn’t some way to turn the tables and express yourself in code".* Ok, è un po' radicale ma, per la miseria, c'è tanta ragione. Invece di scrivere codice così; # Incremento il numero della fattura n += 1 Dobbiamo scrivere codice che si documenta da solo: numero_fattura += 1 In questo modo non potrà esiste un commento che si allontana dal codice, diventando così più un danno che un vantaggio. Ciao. Marco. -- http://beri.it/ - Un blog http://beri.it/i-miei-libri/ - Qualche libro http://beri.it/articoli/ - Qualche articolo
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python