<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 10/28/2013 01:41 PM, JD wrote:<br>
</div>
<blockquote cite="mid:526EA1B8.1020209@algoloma.com" type="cite">
<pre wrap="">It is possible to create crap code in any language, of that I am certain. Some
of my recent perl stuff is just a gorgeous as the highly reviewed code that
introduced those catastrophic bugs. Being pretty does not guaranty bug-free. I'd
submit that pretty code makes finding bugs harder ... sometimes.</pre>
</blockquote>
<br>
I suppose that depends on how we define "pretty".<br>
<br>
I define "pretty" as:<br>
<ul>
<li>Following a consistent code style throughout an entire source
file.</li>
<li>Using proper visual cues to indicate program flow; in
languages where brackets are used, indentation must follow the
flow as indicated by the brackets.</li>
<li>Functions do One Thing and Do It Well™.</li>
<li>With some exceptions (e.g., state machine implementations are
a prominent example), functions should be limited to less than
about 20–30 lines of code, and no more than three or so levels
of indentation. If you're doing more than that, break it
apart. This makes it a lot more testable anyway. Put another
way, functions must be short enough to be "obviously
correct"—and should not be "clever" unless a previously
obviously-correct and tested implementation is being optimized.<br>
</li>
<li>Speaking of testing, test, test, test. I think that testing
is so important that I think on future projects I'm going to
consider writing the tests themselves to be non-billable time,
so that there is no objection to them being done. If not every
line and every branch is tested both for success and failure
cases, it's <i>broken</i>.</li>
</ul>
— Mike<br>
<br>
<div class="moz-signature">-- <br>
<table border="0">
<tbody>
<tr>
<td> <br>
</td>
<td> Michael B. Trausch<br>
<br>
President, <strong>Naunet Corporation</strong><br>
☎ (678) 287-0693 x130 or (855) NAUNET-1 x130<br>
FAX: (678) 783-7843<br>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>