WellWrittenCode is '''correct''' and: * WellTestedCode * WellFormattedCode * WellFactoredCode * WellCommentedCode -- KentSchnaith * SelfDocumentingCode After meditating a little more on this, writing well-written code goes far beyond any mechanical method. Now I must meditate more on this, but perhaps other people have some ideas. -- SunirShah Perhaps WellWrittenCode is subject to the UnwrittenRule? When is code SimpleEnough? ''If you mean prior to refactoring, then surely when it works and passes all tests? There's an infamous joke that every piece of code could have one less line of code and contains at least one bug; which by induction implies that all code could be reduced to one buggy line. I think that's the theoretical limit. :) Seriously though, after refactoring, it would be when you could walk an average programmer through the code and they come out on the other side understanding it. I've had this mantra for a few years that source code is not a means for communicating with the compiler, it's a means for communicating with other developers, as in SourceCodeIsUserInterface. It's very hard to measure though.'' Unfortunately, the evaluation of whether code is well written and simple enough is subjective. It varies from individual to individual and by individual over time. My personal definition of well written has evolved as I have been introduced to different methods of writing code. This idea of the definition of "well written" changing over time even for a fixed block of code is raised in Martin Fowler's Refactoring book. Simple enough has a dynamic tension between generality and specificity. On one hand, simplicity reflects limiting the code to just the requirements, acceptance tests, or unit tests it must meet. On the other hand simplicity reflects generalization to use common, well understood approaches. There will probably never be a precise set of criteria for either well written or simple enough, I think we will have to be content with removing egregious violations of principles and make a subjective decision when the code is good enough. -- WayneMack ---- CategorySimplification