Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
 
     
   Compare ISP   Rate your ISP
   Glossary   Glossary
 
Please login or register.

Login with username, password and session length
Advanced search  

News:

Author Topic: How To Write Unmaintainable Code or 'Protect your coding job' :) <jk>  (Read 3286 times)

AArdvark

  • Kitizen
  • ****
  • Posts: 1008

Anyone who has had to maintain code of 'Software of unknown provenance' aka SOUP* ;D will appreciate the following.

https://www.thc.org/root/phun/unmaintain.html

Quote
Example:

Reverse the Usual True False Convention
Reverse the usual definitions of true and false. Sounds very obvious but it works great. You can hide:

    #define TRUE 0
    #define FALSE 1

somewhere deep in the code so that it is dredged up from the bowels of the program from some file that noone ever looks at anymore. Then force the program to do comparisons like:

    if ( var == TRUE )

    if ( var != FALSE )

someone is bound to "correct" the apparent redundancy, and use var elsewhere in the usual way:

    if ( var )

Another technique is to make TRUE and FALSE have the same value, though most would consider that out and out cheating. Using values 1 and 2 or -1 and 0 is a more subtle way to trip people up and still look respectable. You can use this same technique in Java by defining a static constant called TRUE. Programmers might be more suspicious you are up to no good since there is a built-in literal true in Java.

*
Software previously developed for which 'adequate records' of the development processes are 'not available'.  ::)
Usually covered by the warning 'Whatever you do, Don't touch that it just works!!'  :D ;)
Logged

burakkucat

  • Respected
  • Senior Kitizen
  • *
  • Posts: 38300
  • Over the Rainbow Bridge
    • The ELRepo Project
Re: How To Write Unmaintainable Code or 'Protect your coding job' :) <jk>
« Reply #1 on: January 28, 2016, 08:28:34 PM »

It is well-known by those who need to make adjustments to long established code that "just works" to --
  • ignore any version of the source code
  • make use a debugger or other means and modify the binary code
(b*cat has been there and has done exactly as no. 2.  :D  )
Logged
:cat:  100% Linux and, previously, Unix. Co-founder of the ELRepo Project.

Please consider making a donation to support the running of this site.

adrianw

  • Reg Member
  • ***
  • Posts: 163
Re: How To Write Unmaintainable Code or 'Protect your coding job' :) <jk>
« Reply #2 on: January 30, 2016, 02:56:26 PM »

Mmm.
1 Yes. With something long established, you might find many source versions (which one do I choose?) or none.
2 BTDT, or something similar. On the console to answer "Did it have file X open when it crashed?". The customer thought it was magic.
Logged