I don’t know about how everyone out there deals with maintaining code that a former person in your position created, but I feel like I could scream! I am currently working in a Python script that someone who used to work in my job position wrote, and they were able to write some very unmaintainable code, IMHO.
My only guess for this type of coding is for job security. The following are some of the traits of his code:
- Many similar variable names such as:
XML_page_1a
XML_page_1b
XML_page_5
XML_page_5c
sql10
sql15
sql21 - A “try” statement for each line of code
- Creating queries with include variables such as:
sql13 = “INSERT INTO %s(id,name,address,zip,telephone,email,is_married,is_driver,in_office,%s,col%i)
VALUES (%i,’%s’,'%s’,'%s’,'%s’,'%s’,%i,%i,%i)” (table,varCol,colID,id,name,address,zip,telephone,email,is_married,is_driver,in_office) - Using mixed cased variables interchangeably:
BASE
rel_base
source
sourceFile
source_file
sourceDir
source_dir
proj_txt
VPROJS - Overusing an improperly scoping a temporary variable: tmp.
- Creating a file with 2600+ lines of code that could be wittled down to a couple hundred
To correctly copy this type of programming, you need to be highly skilled. I remember reading an article about it and I was very impressed at the detail and training it takes to do such programming. I think it may be in my best interest, and the interest of my family, to adopt these methods to continuously have a job.
