[ale] Any language (wuz: Assembly Language?)
Michael B. Trausch
mbt at naunetcorp.com
Mon Oct 28 14:01:00 EDT 2013
On 10/28/2013 01:41 PM, JD wrote:
> 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.
I suppose that depends on how we define "pretty".
I define "pretty" as:
* Following a consistent code style throughout an entire source file.
* Using proper visual cues to indicate program flow; in languages
where brackets are used, indentation must follow the flow as
indicated by the brackets.
* Functions do One Thing and Do It Well^(TM).
* 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.
* 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 /broken/.
--- Mike
--
Michael B. Trausch
President, *Naunet Corporation*
? (678) 287-0693 x130 or (855) NAUNET-1 x130
FAX: (678) 783-7843
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20131028/d31c0e0f/attachment.html>
More information about the Ale
mailing list