You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -131,7 +131,7 @@ Never use `i` for the innermost loop variable. Use anything but. Use `i` liberal
131
131
####Conventions Schmentions
132
132
133
133
134
-
Ignore the[Sun Java Coding Conventions](http://web.archive.org/web/20091003224540/http://java.sun.com/docs/codeconv/), after all, Sun does. Fortunately, the compiler won't tattle when you violate them. The goal is to come up with names that differsubtlely only in case. If you are forced to use the capitalisation conventions, you can still subvert wherever the choice isambigous, e.g. use*both*_input**F**ile**n**ame_ and_input**f**ile**N**ame_. Invent your own hopelessly complex naming conventions, then berate everyone else for not following them.
134
+
Ignore the[Sun Java Coding Conventions](http://web.archive.org/web/20091003224540/http://java.sun.com/docs/codeconv/), after all, Sun does. Fortunately, the compiler won't tattle when you violate them. The goal is to come up with names that differsubtly only in case. If you are forced to use the capitalisation conventions, you can still subvert wherever the choice isambiguous, e.g. use*both*_input**F**ile**n**ame_ and_input**f**ile**N**ame_. Invent your own hopelessly complex naming conventions, then berate everyone else for not following them.
135
135
136
136
####Lower Case l Looks a Lot Like the Digit 1
137
137
@@ -188,7 +188,7 @@ Hungarian Notation is the tactical nuclear weapon of source code obfuscation tec
188
188
189
189
####Hungarian Notation Revisited
190
190
191
-
Onefollowon trick in the Hungarian notation is "change the type of a variable but leave the variable name unchanged". This is almost invariably done in windows apps with the migration from Win16:
191
+
Onefollow-on trick in the Hungarian notation is "change the type of a variable but leave the variable name unchanged". This is almost invariably done in windows apps with the migration from Win16:
192
192
193
193
```c
194
194
WndProc(HWND hW, WORD wMsg, WORD wParam, LONG lParam)
@@ -313,7 +313,7 @@ Maintenance programmers, in order to see if they'll be any cascading effects to
313
313
#define local_var xy_z // in file ..\codestd\inst.h
314
314
```
315
315
316
-
These defs should be scattered through different include-files. They are especially effective if the include-files are located in different directories. The other technique is to reuse a name in every scope. The compiler can tell them apart, but a simple minded text searcher cannot. Unfortunately SCIDs in the coming decade will make this simple technique impossible. since the editor understands the scope rules just as well as the compiler.
316
+
These defs should be scattered through different include-files. They are especially effective if the include-files are located in different directories. The other technique is to reuse a name in every scope. The compiler can tell them apart, but a simple minded text searcher cannot. Unfortunately SCIDs in the coming decade will make this simple technique impossible, since the editor understands the scope rules just as well as the compiler.
317
317
318
318
#### Long Similar Variable Names
319
319
@@ -370,7 +370,7 @@ This one gets fun when passing `g()` a `char*`, because a different version of `
370
370
371
371
#### Compiler Directives
372
372
373
-
Compiler directives were designed with the express purpose of making the same code behave completely differently. Turn the booleanshort-circuiting directive on and off repeatedly andvigourously, as well as thelong strings directive.
373
+
Compiler directives were designed with the express purpose of making the same code behave completely differently. Turn the booleanshort-circuiting directive on and off repeatedly andvigorously, as well as thelong strings directive.
374
374
375
375
## Documentation
376
376
@@ -386,7 +386,7 @@ You don't have to actively lie, just fail to keep comments as up to date with th
386
386
387
387
####Document the obvious
388
388
389
-
Pepper the code with comments like`/* add 1 to i */` however, never documentwooly stuff like the overall purpose of the package or method.
389
+
Pepper the code with comments like`/* add 1 to i */` however, never documentwoolly stuff like the overall purpose of the package or method.
390
390
391
391
####Document How Not Why
392
392
@@ -530,7 +530,7 @@ Lots of them. Move data between the arrays in convoluted ways, say, filling the
530
530
531
531
####Mix and Match
532
532
533
-
Use both accessor methods and public variables. That way, you can change an object's variable without the overhead of calling the accessor, but still claim that the class is a "Java Bean". This has the additional advantage of frustrating themaintenence programmer who adds a logging function to try to figure out who is changing the value.
533
+
Use both accessor methods and public variables. That way, you can change an object's variable without the overhead of calling the accessor, but still claim that the class is a "Java Bean". This has the additional advantage of frustrating themaintenance programmer who adds a logging function to try to figure out who is changing the value.
534
534
535
535
####Wrap, wrap, wrap
536
536
@@ -560,7 +560,7 @@ Instead of using a parameter to a single method, create as many separate methods
560
560
561
561
Make as many of your variables as possible static. If_you_ don't need more than one instance of the class in this program, no one else ever will either. Again, if other coders in the project complain, tell them about the execution speed improvement you're getting.
562
562
563
-
####Cargill'sQuandry
563
+
####Cargill'sQuandary
564
564
565
565
Take advantage of Cargill's quandary (I think this was his) "any design problem can be solved by adding an additional level of indirection, except for too many levels of indirection." Decompose OO programs until it becomes nearly impossible to find a method which actually updates program state. Better yet, arrange all such occurrences to be activated as callbacks from by traversing pointer forests which are known to contain every function pointer used within the entire system. Arrange for the forest traversals to be activated as side-effects from releasing reference counted objects previously created via deep copies which aren't really all that deep.
566
566
@@ -721,7 +721,7 @@ Nest as deeply as you can. Good coders can get up to 10 levels of `( )` on a sin
721
721
722
722
####Numeric Literals
723
723
724
-
If you have an array with 100 elements in it, hard code the literal 100 in as many places in the program as possible. Never use a static final named constant for the 100, or refer to it as`myArray.length`. To make changing this constant even more difficult, use the literal 50 instead of 100/2, or 99 instead of 100-1. You canfuther disguise the 100 by checking for`a == 101` instead of`a > 100`, or`a > 99` instead of`a >= 100`.
724
+
If you have an array with 100 elements in it, hard code the literal 100 in as many places in the program as possible. Never use a static final named constant for the 100, or refer to it as`myArray.length`. To make changing this constant even more difficult, use the literal 50 instead of 100/2, or 99 instead of 100-1. You canfurther disguise the 100 by checking for`a == 101` instead of`a > 100`, or`a > 99` instead of`a >= 100`.
725
725
Consider things like page sizes, where the lines consisting of x header, y body, and z footer lines, you can apply the obfuscations independently to each of these and to their partial or total sums.
726
726
727
727
These time-honoured techniques are especially effective in a program with two unrelated arrays that just accidentally happen to both have 100 elements. If the maintenance programmer has to change the length of one of them, he will have to decipher every use of the literal 100 in the program to determine which array it applies to. He is almost sure to make at least one error, hopefully one that won't show up for years later.
@@ -1209,7 +1209,7 @@ Make it so elaborate that no maintainer could ever get any of his or her fixes t
1209
1209
1210
1210
####More Fun With Make
1211
1211
1212
-
Have the makefile-generated-batch-file copy source files from multiple directories with undocumentedoverrwrite rules. This permits code branching without the need for any fancy source code control system, and stops your successors ever finding out which version of`DoUsefulWork()` is the one they should edit.
1212
+
Have the makefile-generated-batch-file copy source files from multiple directories with undocumentedoverwrite rules. This permits code branching without the need for any fancy source code control system, and stops your successors ever finding out which version of`DoUsefulWork()` is the one they should edit.
1213
1213
1214
1214
####Collect Coding Standards
1215
1215
@@ -1332,7 +1332,7 @@ At least one variable should be set everywhere and used almost nowhere. Unfortun
1332
1332
1333
1333
The people who design languages are the people who write the compilers and system classes. Quite naturally they design to make their work easy and mathematically elegant. However, there are 10,000 maintenance programmers to every compiler writer. The grunt maintenance programmers have absolutely no say in the design of languages. Yet the total amount of code they write dwarfs the code in the compilers.
1334
1334
1335
-
An example of the result of this sort of elitist thinking is the JDBC interface. It makes life easy for the JDBCimplementor, but a nightmare for the maintenance programmer. It is far**clumsier** than the FORTRAN interface that came out with SQL three decades ago.
1335
+
An example of the result of this sort of elitist thinking is the JDBC interface. It makes life easy for the JDBCimplementer, but a nightmare for the maintenance programmer. It is far**clumsier** than the FORTRAN interface that came out with SQL three decades ago.
1336
1336
1337
1337
Maintenance programmers, if somebody ever consulted them, would demand ways to hide the housekeeping details so they could see the forest for the trees. They would demand all sorts of shortcuts so they would not have to type so much and so they could see more of the program at once on the screen. They would complain loudly about the myriad petty time-wasting tasks the compilers demand of them.