Live data from Hacker News

Art of writing unmaintainable code.

thc.org

21–30 of 39 posts

Re: Art of writing unmaintainable code.

#22

i 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.

Re: Art of writing unmaintainable code.

#23

Earlier 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…

If we're talking emacs, you can configure it to do whatever you want. So no, it does not always mean "insert spaces until the next tab stop".

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…

I wish I still thought that was funny, instead of just painful. I can't tell you how many times I have been burned on Is or Get methods with incredible side effects, like IsValid also automatically logs the user in, creates them if they don't exist, and retrieves their birthday from the database to make sure it's valid. (edit: yes, that really happened.)

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…

That "isValid(x)" line is my favorite as well. I'm sure discovering these bizarre side-effects has taken days (weeks, months?) of all our lives.

Re: Art of writing unmaintainable code.

#26
post #12

Most 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…

They did qualify that this isn't an example of the original intent of Hungarian Notation

"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.

#27
post #13

The 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.

The output of print_r on a single form on a page could probably stretch to the moon and back if each line was laid one after the other.

Recursively, of course.

Re: Art of writing unmaintainable code.

#30
post #22

i 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.

Enumerating some of the ways to screw things up may be helpful in that it allows a reasonably intelligent reader to intuit the underlying connections and apply that intuition to a broader set of coding circumstances.
Post reply on HN