News for hackers. Stuff that matters.
Re:Making Code Easy to Understand – What Developers Want (a ... by wccrawford on Thursday July 28, 2011 @11:09AM (#2817121)
I like how 'code examples' are above 'test cases' ... But a test case would include a code example, and proof that it works. -sigh-
Re:Making Code Easy to Understand – What Developers Want (a ... by angdis on Thursday July 28, 2011 @11:36AM (#2817288)
I think code examples are something that are best included in the "getting started" section of documentation. It gives the user a quick, usable, concise illustration of how to perform the most basic tasks. Sometimes that's all you need and this is frequently omitted by some software documentation.

Test cases are certainly useful if you need to dive into comprehensive/advanced usage of the API. But if you just want to "get started", a huge vat of unit tests can be daunting.

Re:Making Code Easy to Understand – What Developers Want (a ... by gigamonkey on Thursday July 28, 2011 @12:24PM (#2817545)
But would a test case be a good example of using the code? As in, good for the purpose of understanding the code.
Re:Making Code Easy to Understand – What Developers Want (a ... by chc on Thursday July 28, 2011 @01:05PM (#2817765)
Technically, all the code in your program could rightly be called a "code example." But it's not very good for determining how to use the code in your program. Test cases are closer to being good code examples, but they're still generally optimized for checking correctness rather than illustrating use. If nothing else, a good, complete set of test cases will be full of distracting noise.