Here is an email I received in response to my essay on how to write unmaintainable code.
You are quite right. The essay started as therapy. I would get so angry when I encountered poor code. The essary was a opportunity to ridicule it and lampoon it. I discovered that readership for my essays on how to write unmaintainable code had orders of magnitude better readership than my essays on how to write good code. Now when I encounter terrible code, I clap my hands in glee — another item for my collection.
I am sending you two suggestions into Unmaintainable code howto. I think both of them are beautiful way for writing messier code.
function foo(bar) {
var baz = function() {
return bar;
}
return baz;
}
var x = foo(2);
y = x(); // y is 2;
By mixing closures which have side-effects and reusing variables from global scope, one can create beautiful parts of
code, even more beuautiful than the obfocusator would.
I have never seen code like that before, outside of FORTH. Are you sure that would compile? I am so used to Java where all the case clauses must be evaluated an compile time without duplicates.
I would appreciate, if you find at least some pieces of this code helpful for extending your Unmaintainable code howto.
| You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | |
| http://mindprod.com/feedback/unmain/closure.html | J:\mindprod\feedback\unmain\closure.html | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view | Your face IP:[38.107.191.110] | |
| Feedback | You are visitor number 11. | |