[Sussex] Code-writing methods

Geoff Teale gteale at cmedresearch.com
Fri Nov 17 10:43:47 UTC 2006


On Thursday 16 November 2006 23:19, Nic James Ferrier wrote:
---- %< ------------

> One of the areas where I do comment my code is where I have tried to
> be clever. Cleverness is almost always a mistake and end up with the
> "why did I do that? it's so clearly wrong" moments.

Never a truer word spoken.  

> Gosling Emacs is famous for it's very clever display code and the
> amusing comment that preceeds the code.

Ah, Gosmacs... also famous for it's sale to a proprietary software company and 
resulting legal issues surrounding that sale which led RMS to develop the 
Emacs Public License - the first legal step on the road to the GPL.

Those kind of "cleverness" comments have a friend: the "don't do what you 
usually do" comment.  There are occasions where odd behaviour means that 
things interact in a non obvious way. 


I work these days in various combinations of Python, Scheme, Emacs Lisp, BASH, 
Javascript and C.  The example in my head right now is the import order of 
UNO modules into python when trying to script openoffice.   If early version 
of pyUno if you import the modules in the wrong order the program would 
crash.   Unfortunately that order was not alphabetical (which broke Cmed's 
in-house coding style) and I had to comment that because I knew that there 
was at least one person who would see the CVS check-in and instantly go and 
fix the coding style issue without properly testing.

-- 
Geoff Teale
Software Engineering Team Leader

Cmed Group Ltd.
Holmwood
Broadlands Business Campus
Langhurstwood Road
Horsham RH12 4QP
United Kingdom


T +44 (0)1403 755071
F +44 (0)1403 755051
E gteale at cmedresearch.com
W www.cmedresearch.com
__________________________________________________________

Driven by technology. Guided by experience.
__________________________________________________________




More information about the Sussex mailing list