I recently joined an organization in which I am to be one of the two new lead developers on the public website. The previous developer (who was alone) left a sizable codebase which although functional, is rigid and fragile. Normally, the saying goes "if it ain't broke don't fix it", but in this case the poor coding style and lack of documentation makes the code unreadable (to me, the other developer, and our interns) and thus require extra time when adding features, tweaking things. Both my partner and I have deemed it essential for both our mental well-being as well as necessary if the development teams are to progress on the organization's schedule.

The problem is that our boss, who is also the head of the organization (biology phD, not a developer) thinks that the last guy was brilliant, and doesn't believe that a rewrite is necessary. Both my partner and I have attempted to contact the previous developer, but to no avail - it appears that he has disappeared off the face of the earth. How do I/we convince the boss the code is in dire need of a major rewrite?

Past Action:

  • We've informed our boss the code is a mess
  • We've showed him the code (he responds, "what's wrong with it?")

EDIT I'm am almost completely certain a rewrite is needed. I apologize to all the non-pythonistas out there, but the code looks like this:

def index(request):
    return render(request,'index.html',locals())

repeated for perhaps 20 of the 30 "view" functions in the code. For those of you who don't understand, this type of code essentially requires every member of the team to memorize what is used for each template, and makes it difficult to change the code without breaking anything. From what I could tell, the previous developer had no more than 1 year worth of experience coding, and perhaps none professionally. The code is quite buggy right now, and nobody can quite figure out where/why.

If it changes anything, this is a non-profit research organization so grabbing market share isn't that important, but since members generally stay for about a year or so (while doing their post-doc work) I think readability/ease of maintenance is probably the single largest thing we need (other than functionality).

closed as off-topic by Simon O'Doherty, CincinnatiProgrammer, jcmeloni, Telastyn, HLGEM Aug 1 '13 at 13:44

  • This question does not appear to be about the workplace within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.


You need to convince him in the language that he understands.

Are you able to quantify the impact of "bad" code?

How much technical debt have you incurred, how it is impacting developer productivity, code stability, quality.

Are you able to give him a demo on the lines of

  1. Take the worst area of the code could be the buggiest,unstable or in extensible due to bad code.
  2. Choose a current metric - X number of hours to review code, Y number of bug currently in the code due to it being of poor standards, Z number of hours to extend current code to implement feature A
  3. Refactor or redesign it
  4. Reflect change and demonstrate how much time it takes now .....X1 , Y1, Z1

This won't be trivial effort and could be a mini project. But if you feel strongly about the situation and want to change it, dont ask permission and do it and show him the results.


First, 'needs a rewrite' is vague. You have to be able to draw boxes around offending code or definitions.

If the old developer wrote code that left the site exposed to SQL injection attacks, show your boss before and after (what you have, what it should be, and the consequences of the old style). Is the application simply forms with no classes for tables, no data services, no user controls, and no unit tests? Then show him how you go through 50 forms making in-situ code edits when a single column added to a table. Inconsistencies - show him Form A done one way and Form B done another, and why they should have more in common.

If that doesn't work, you'll have to show him badly structure biological systems, and explain why the code you have is equivalent to global warming and ocean acidification.

Given further details (Python and scattered global variable use) I would describe the present system in the following terms: 'Within this 200,000 line codebase there are definitions that 'visible' to any line of code, and these definitions are scattered at random in the files. If anyone changes or adds any of these definitions, then everyone involved in the project has to know about them before they make any modifications on their part. One programmer doing this by himself can keep this straight, but that's not how we're doing it. We need to designate certain places for things to be, certain rules for things to follow, and certain patterns that, if we know how one is done, we kind of know what to expect for all similar structures.'

Start paging down through the files while your boss is remoted in or looking over your shoulder, searching for the globals, and ask your boss to memorize each one. Then tell him you'll have to bring him up to speed any time anyone of the programmers changes or adds any of those variables. Have some kind of structural documentation that explains what your target is, and the minimum cost approach to reaching it.

Another approach: hint that you have a spreadsheet with 100 pages. Each page has 1000 rows times 100 columns of values. Within these 100 pages there are 100 'primitive' cells that have no formula - all other cells are calculated from these 100 'primitives'. His job is to know where all those 100 primitive cells are and keep in his head what they do to affect the spreadsheet calculations. Cells are in different locations in each spreadsheet and none have special highlighting, fonts, or backgrounds. Given this spreadsheet, ask 3 people to make structural changes (not simply data elements), which in some cases involves adding a few more 'primitive' cells. It's up to everyone on the team to make sure these changes are coordinated.

  • From our (me and the other project lead) assessment, the code is essentially unsalvagable, at least in part due to the abuse of python's locals and globals throughout the code. Essentially, the entire codebase was written by one programmer – Snakes and Coffee Jul 31 '13 at 22:01
  • @SnakesandCoffee - While I'm not familiar with Python, I can see a scenario where you get an error condition, and then have to figure out what is within scope at each potential debug point. Is your boss the kind of person what would sit and watch while you went through this exercise? Would this be persuasive? – Meredith Poor Jul 31 '13 at 23:56
  • Unfortunately, he's usually flying out somewhere to give a talk on something/meeting with professors, and so I rarely see him (he's in Michigan). – Snakes and Coffee Aug 1 '13 at 0:06
  • What I see here is an attempt to maintain the entire project 'symbol table' (every variable and constant in the system) in the heads of everyone on a team. One person can do this, but now you have multiple people that have to all know 'everything', including the new objects created by other people as quickly as they create them. Sounds very dangerous to me. – Meredith Poor Aug 1 '13 at 0:52

I have been in your situation many times before, and have had similar issues involving the inheritance of bad architecture and poorly maintained code in the past and present. Fortunately, in my current position, my boss does have a programming background and has encouraged me to do whatever I need to do to improve the quality from both a performance and change management perspective.

Because your boss lacks the technical expertise to fully comprehend what you mean, you are never going to get his/her buy-in on making wholesale changes to the code. The best you can hope to do is restructure an rebuild it piece by piece as you go along. Draft a master infrastructure plan and instruct the other developers that any future additions or revisions need to be implemented according to that plan. This way, everyone gets what they want--your boss gets to keep the water running and you get to install brand new pipes where they are most needed, instead of having to patch on top of patches. In addition, it will give you a little extra time to dig deeper into the existing requirements of the system and incorporate any "new" requests that have been sitting on the back burner because of the instability of the current system.


I experienced the same difficulty with my current boss. However, I sat with him and explained him why I thought that changing the code was necessary. Since your boss doesn't have a programming background, maybe you should try to explain the problem to him with an analogy. Explain the problem as an everyday problem, for example: if we were building a car, said vehicle wouldn't work because of this and that problems of design, therefore we should redesign. Maybe with a different approach your boss will understand more clearly why you should rewrite the code. I must stress that you shouldn't necessarily "blame" the author of the code for the evident deficiencies (even if he wrote it poorly in the first place), because it could give the wrong impression to your boss and cause you unnecessary problems. Instead, suggest ways to improve the code and explain why you believe that those are the way to go.

  • Analogy is a good idea. However, non-programming background doesn't necessarily mean non-technical. In some cases people's understanding is close enough that a programmer-to-programmer explanation works. – Meredith Poor Aug 1 '13 at 23:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.