

How To Write Unmaintainable Code - r4um
http://home.tamk.fi/~jaalto/course/coding-style/doc/unmaintainable-code/

======
bcRIPster
from page... zOMG this is evil!

CODE THAT MASQUERADES AS COMMENTS AND VICE VERSA

Include sections of code that is commented out but at first glance does not
appear to be.

    
    
          for ( j=0; j < array_len; j +=8 )
          {
             total += array[j+0];
             total += array[j+1];
             total += array[j+2]; /* Main body of
             total += array[j+3]; * loop is unrolled
             total += array[j+4]; * for greater speed.
             total += array[j+5]; */
             total += array[j+6];
             total += array[j+7];
          }    
    

Without careful attention , would you notice that three lines of code are
commented out?

~~~
TrainedMonkey
Or you could just use virtually any IDE with comment highlighting. Quite a few
of patterns mentioned are either mitigated or defeated by good IDE.

~~~
zalew
if by IDE you mean an editor, you don't need an IDE to have syntax
highlighting.

------
lkrubner
I like this one:

Object oriented programming is a godsend for writing unmaintainable code. If
you have a class with 10 properties (member/method) in it, consider a base
class with only one property and subclassing it 9 levels deep so that each
descendant adds one property. By the time you get to the last descendant
class, you'll have all 10 properties. If possible, put each class declaration
in a separate file. This has the added effect of bloating your INCLUDE or USES
statements, and forces the maintainer to open that many more files in his or
her editor. Make sure you create at least one instance of each subclass.

~~~
interstitial
They must of got that idea from Magento.

------
RyanZAG

        Underscore, a Friend Indeed
      Use _var and __var in identifiers. 
    

Even better when it's sometimes __ and sometimes ___ - you can never tell
which it is at a glance. (Python is great for this one!)

------
acheron
A classic.

My favorite is "Properly-written code never fails, so exceptions are actually
unnecessary."

~~~
strictfp
A new one, somewhat related to exceptions:

"If you don't know what to do, just return null and pretend like nothing
happened! This way you can put all the blame on the caller. Your code
effectively becomes flawless!"

------
wrongc0ntinent
This should be translated in a few languages I can think of.

------
interstitial
I'm going to copy and paste this into any empty or default text README.md's I
find in projects I'm assigned to work on. Perhaps Github should also post it
as the default README.md for any new project.

------
AsymetricCom
These are all great suggestions, because it's very often (always) that
management assumes they know what your software does given the output.

