From: chad fowler Date: 2001-04-22T22:42:14+09:00 Subject: [ruby-talk:14020] Re: From Guido, with love... --- Mitch Vincent wrote: > > > You don't need comment when the code is very > well written. > > I don't think that could be further from the > truth... Code that is well > written can still be extremely complex and hard for > anyone to understand.. > Besides, I define "well written code" as code that > makes smart use of > whitespace, comments and hungarian notation. So, by this definitions, one could write a totally obfuscated, unoptimized mess that doesn't meet the requirements of the project, and it would still be good? > If you got rid of the > comments in any of my code > (for some of the larger projects), you'd run into > trouble quick when you > made changes.. I always try to include "If you > change this, you have to > change X,Y,Z over in the XYZ function etc etc" type > comments... Code that is properly factored shouldn't have these kinds of hidden dependencies. If you need a comment like the one mentioned above, you've most likely violated the law of Demeter and should start refactoring soon. See http://www.c2.com/cgi/wiki?LawOfDemeter. > *Good* comments are priceless, IMHO. *Good* > comments can shave hours and > hours off code comprehension -- learned this from > experience, though our > experiences are clearly different.. *Good* comments can shave hours off of *bad* code comprehension. Whatever the case, if you can let the code speak for itself, you don't run the risk of sync issues between your code and its documentation. Chad __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/