Personal web server - Obfuscation (Advice) Needless complexity in the arrangement of
Obfuscation (Advice) Needless complexity in the arrangement of tokens in a line of executable script. There are competitions on the Internet to write the most egregious and highly functional code fragment in the fewest lines of code. This is particularly easy to do in C language. Certain operators lend themselves to the construction of extremely terse code, which, although functionally very clever, is also very hard to understand when diagnosing faults or carrying out maintenance. This entry is not to recommend against the use of such operators, but to urge a word of caution on the basis that modern language parsing and execution engines may be smart enough to highly optimize the code, making any performance gains negligible anyway. These days, it is quite difficult to yield any noticeable performance gains by epitomizing the code at the source level with compiled systems. There may still be some gains to be won with interpreted code. A badly designed algorithm may continue to perform badly in an interpreter where there is a possibility it might get corrected in an optimizing compiler. The operators to be particularly cautious about are the assignment operators and the prefix/postfix operators. The ternary conditional operator is also hard to read in source and may offer little advantage over an if( ) else construct. These are equivalent but intent is much more obvious withthe if( ) else form: // Conditional ternary operator myResult = (mySwitch) ? “TRUE VALUE” : “FALSE VALUE” ; // Conditional block if(mySwitch) { myResult = “TRUE VALUE”;} else { myResult = “FALSE VALUE”;}