PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Unmaintainable Code



Bartholmy
25.03.2002, 22:10
Ich fürchte, der Humor von Programmieren ist ähnlich, äh ... eigen wie bspw. der von Musikern.

Gut gefällt mir dennoch oder gerade die Seite:
http://mindprod.com/unmain.html

auf der Roedy Green erklärt, wie man Seiten so programmiert, dass der Code dannach garantiert von niemandem mehr gepflegt werden kann.

Kleines Beispiel:

"In the interests of creating employment opportunities in the Java programming field, I am passing on these tips from the masters on how to write code that is so difficult to maintain, that the people who come after you will take years to make even the simplest changes. Further, if you follow all these rules religiously, you will even guarantee yourself a lifetime of employment, since no one but you has a hope in hell of maintaining the code. Then again, if you followed all these rules religiously, even you wouldn't be able to maintain the code!"

Konkret:

"1) Single Letter Variable Names:
If you call your variables a, b, c, then it will be impossible to search for instances of them using a simple text editor. Further, nobody will be able to guess what they are for. If anyone even hints at breaking the tradition honoured since FØRTRAN of using i, j, and k for indexing variables, namely replacing them with ii, jj and kk, warn them about what the Spanish Inquisition did to heretics.

2) Creative Miss-spelling:
If you must use descriptive variable and function names, misspell them. By misspelling in some function and variable names, and spelling it correctly in others (such as SetPintleOpening SetPintalClosing) we effectively negate the use of grep or IDE search techniques. It works amazingly well. Add an international flavor by spelling tory or tori in different theatres/theaters.

3) Be Abstract:
In naming functions and variables, make heavy use of abstract words like it, everything, data, handle, stuff, do, routine, perform and the digits e.g. routineX48, PerformDataFunction, DoIt, HandleStuff and do_args_method.

4) A.C.R.O.N.Y.M.S.:
Use acronyms to keep the code terse. Real men never define acronyms; they understand them genetically."

usw. usf.

DerCaptain
26.03.2002, 01:00
Real men never define acronyms; they understand them
Herrlich. Mein Alltag. Ich liebe es.