switch (n)
{
case 1:
p = "one";
if (0)
case 2:
p = "two";
if (0)
case 3:
p = "three";
break;
}Art of writing unmaintainable code.
21–30 of 39 posts
Re: Art of writing unmaintainable code.
#22i sorta think this is dumb. these are all true, but superficial. this piece doesn't touch on any real, deeper reasons that well-intentioned code is unmaintainable, like excessive and unnecessary state & implementation inheritance.
Re: Art of writing unmaintainable code.
#23Earlier quoted context omitted.
Agreed - and while most of this is obvious, and some insightful, some of it is just baseless opinion: "Never underestimate how much havoc you can create by indenting with tabs instead of spaces..." Conversely, never underestimate how much havoc you can create by using spaces for indentation. With tabs, the level of indentation is clear and atomic. With spaces, it is arbitrary, and, wait for it... hard to maintain
As someone who, despite being 24 years old, learned to type on a (mechanical!) typewriter, I don't like tab for indentation on the basis that, for me, tabs have a very specific meaning: Carriage (or cursor, if you prefer), go to the next tab stop . [2] For typewriters it means to go "literally" to where the next stop is. For text editors (at least for emacs)[1], it means to insert as many spaces as needed so the next…
Re: Art of writing unmaintainable code.
#24" Randomly capitalize the first letter of a syllable in the middle of a word. For example ComputeRasterHistoGram(). " I do this by accident all the time. And this is the funniest thing I've read on the internet all year: " Make sure that every method does a little bit more (or less) than its name suggests. As a simple example, a method named isValid(x) should as a side effect convert x to binary and store the result…
Re: Art of writing unmaintainable code.
#25" Randomly capitalize the first letter of a syllable in the middle of a word. For example ComputeRasterHistoGram(). " I do this by accident all the time. And this is the funniest thing I've read on the internet all year: " Make sure that every method does a little bit more (or less) than its name suggests. As a simple example, a method named isValid(x) should as a side effect convert x to binary and store the result…
Re: Art of writing unmaintainable code.
#26Most of this is true, but I hate to have people continue to give hungarian notation a bad name when idiomatic use of it is quite a lot better than the naïve use of it decried here. As an aside, do any other Haskell hackers find that single letter variable names are a lot more usable than in other languages? x:xs, y' and their ilk seem more readable than in other languages and often more readable than long variable na…
"The following tips will help you corrupt the original intent of Hungarian Notation"
But it's not really that clear if you've not heard what proper Hungarian Notation is before.
Re: Art of writing unmaintainable code.
#27The Drupal developers must have used this as a coding bible when they came up with the idea of shoving absolutely everything in multi-dimensional arrays.
I love it when the output of print_r is larger than the html of a fully rendered page, by virtue of the html being included in the array you are printing.
Recursively, of course.
Re: Art of writing unmaintainable code.
#28Re: Art of writing unmaintainable code.
#29Isn't that the first item of Effective Java? Factory methods? Which is a good thing.
Re: Art of writing unmaintainable code.
#30i sorta think this is dumb. these are all true, but superficial. this piece doesn't touch on any real, deeper reasons that well-intentioned code is unmaintainable, like excessive and unnecessary state & implementation inheritance.
I agree -- I hate these "negative" lists because there's an infinite number of ways to screw something up. Enumerating them isn't helpful.