Encapsulate The Trivial
Create entire classes or methods to encapsulate trivialities that could never possibly change, but which then require complex invocation, and careful unravelling to discover that the code does almost nothing. Here is a classic example:
\nclass Truth \n{ \n boolean isTrue ( boolean assertion ) \n{ \n if ( assertion != false ) return assertion; \n else return assertion; \n } \n} \n\n ... \n \n Truth trutherizer = new Truth() ; \n if ( trutherizer.isTrue ( s.equals( t ) ) ) doIt = true; \n else doIt = false; \n \n \n // hint: all the above accomplishes is: \n doIt = s.equals( t ); \n
OMG! When the customer input his name, the trutherizer threw an unhandled exception!