23

I'm currently reviewing a system built by some developers that previously worked at my job. The system works pretty well from a user's point of view, but when delving into code review it's a utter mess. I'm more than convinced that the way the application is built won't hold up for future updates, let alone high increases in usage.

The problem is that I know how bad it is, but my superiors don't. How can I prove it to my manager so he actually sees the problem and can be convinced to do minimal triage on the current codebase, and in the near future start a new line of development for the next version of the application?

ChrisR
  • 779

10 Answers10

22

'But it works now' is the standard management response to the legitimate frustrations of software engineers. The first thing I would do would be to compile the documentation (if any) and use that to demonstrate contradictions between the code and the documentation.

If you can, put together a comprehensive suite of unit tests. Run these with every change so you can document regressions which can be blamed on the existing codebase.

Lastly, if you can pull in a developer from another department whose work you trust, get a second pair of eyes on the code. One developer saying 'this is crap' is easier to dismiss, than when a senior developer who has been around a while vouches for him and says, 'No, Jim, he's right. This is crap on a crap cracker.'

Of course, it all depends on your environment, company size, etc.

I always recommend taking a look at The Pragmatic Programmer If you haven't read it. Not only should it be required reading for every software professional, but it has some good suggestions for dealing with management, co-workers, users, etc. who don't view software engineering as a craft.

Jason Lewis
  • 2,113
13

From management's perspective, there's nothing wrong with the system and you are just complaining because [you just want to rewrite it/you don't understand what previous engineers did/you want your job to be easy]. A bit of a straw man, but when someone at the top sees that things are working fine right now, they're disinclined to see a crisis where you do (I'm sure there's a climate change allegory in there somewhere...).

To some extent, they have a point. Management sees problems when releases go well beyond their original estimate, estimates seem too high for the work being done, "this is impossible with our existing code base", and high occurrences of bugs slipping past QA. If things are purring along nicely, it's easy to pat you on the head and tell you to do your best, because it's not affecting the bottom line.

What to do depends on your organization and the software itself. Fundamentally, though, I suggest documenting every complication that comes up as a result of bad legacy code. When estimating tasks, make it clear to management why you think it will take that long, with detailed explanations about what aspects of the old code base are adding this extra cost. When bugs are introduced into the code, include the reasons why this bug was able to slip in, and how issues in the old code base are responsible.

I'd suggest phrasing your concerns to the stakeholders in a way that suggests the software has outgrown its original design and is now problematic to continue enhancing.

Stefan Mohr
  • 340
  • 3
  • 8
5

There are various tools available which can do code coverage and code review. Google tools suitable for your technology, these are normally industry standard tools. I would suggest you use these tools and come up with code-quality report and present it to Manager. Make sure your criticism is contructive and non-political.

ViSu
  • 190
4

Pick an example that is easy to understand where managment would think it is a simple change request, but because of the existing design it is much more difficult.

You don't want them to dwell on the specific request, but make sure you let them know that this is what ANY request for change is going to be like. Nobody wants to be painted in a corner with an application. Developers believe in YAGNI, but management believes in CYA.

The suggestions for load testing could be a good approach, but they may not be convinced the increased usage concerns meets any real world growth potential (The company is not going to double in one year.).

Everything is relative. They may not want to put the resources into this project when they have plans for more important projects to spend your time on. Don't get labeled as not seeing the big picture.

JeffO
  • 36,956
3

When you talk about proving something, all that scientific method stuff comes into play, and part of what that means is that if you are going to accept objective standards of deciding what's true, you must accept the possibility that, upon investigation, those annoying facts turn out not to be on your side.

In your case, I think there are 2 things to be proved.

First, that the current codebase is "bad". What you probably can prove is that "the professional opinion of nearly all developers that examine this code is that it's bad".

Second, that the company would be better off rewriting the codebase. This is a problem because even if the first point is true, the second might not be. Also, you don't know enough to make this determination. This is management's job, and if you want them to respect your professional judgement about the first point, you should respect theirs about the second.

But they can't make the determination about the second point without information you provide. You need to communicate what you know about how the problems in the code will impact the business, and what you know about how a rewrite would impact the business. This is difficult, since both involve predicting a future that has a lot of uncertainty.

But you can try to state the problem in business terms. How much extra time is spent on changes and regressions? What would a rewrite cost? How quickly will the costs of the current system go up over time if not rewritten? What if there is an increase in usage, what's the chance of a disaster if the current code is kept? You can't really know any of this, but you can give a better guess than anyone else. Give a range, or something to communicate how accurately you think you can predict these things.

Most developers do not like maintaining lousy code. Which is why it can be unfortunate that code that is a no-brainer to rewrite from a developer perspective may not be worth rewriting from a business perspective.

For example, even if the rewrite ends up profitable, it might be worth less than the opportunity cost of spending the money elsewhere in the company. Or the bad codebase might take longer to change and have more regressions, but not enough to make a rewrite profitable. They may be looking to get bought out in the next few months, and spending money on a rewrite will show up on the books but buggy software won't.

Try to think about it from the business perspective, and don't cook the numbers to get what you want. A big rewrite is almost never a no-brainer from a business point of view. If you want to prove something not directly provable, try your best to disprove it. If you keep trying your best to come up with a way not to rewrite from scratch but nothing you come up with makes sense, maybe then it's really time to rewrite from scratch. And making that effort will show your management that you are serious about representing the company's interests, not your own (you are representing the company's interest, not your own, right?).

psr
  • 12,866
2

I Guess it depends what is bad about the code base. Being "Not the way I would do things" does not mean it is a bad code base.

Things that actually make a bad code-base:

  • Security holes

    Problems that leave the Server, application, and/or data vulnerable. Especially anything that leave sensitive company, client or customer data at risk. These should be easy to document.

  • Working Broken

    It is only working because you massage the data and perform maintenance on the application nearly continuously to keep it working. If you were to leave and no one took up the slack it would not longer be working. - Document how much time you are spending doing this. And note how much you could save. Quite often these processes are inefficient for users as well and you may be able to document that as well.

  • Does not actually work

    It appears to work but the results are incorrect. This generally causes problems down the line like numbers not matching, high defect rate, etc.

What is not bad codebase (just not good):

  • Written on obsolete unsupported tech. (VB6, COBOL, .net1.1 Etc.)

Note the advantages of migrating to a new technology. Try to find a migration path that moves pieces at a time so that you can minimize risk and build user and management confidence. Make sure that the logic works basically the same as the original.

  • Undocumented/poorly formatted code

This is the easiest for you to fix because generally you can add comments and correct the formatting with out actually impacting the code. But it does not require a rewrite. If you feel this is combined with other issues the first thing to do is fix this so you can better assess the viability of the code.

SoylentGray
  • 3,104
1

You have answered your own question in a way.

The way to convince them to spend money on the system is to wait until it doesn't function well for the user. If you think it won't scale, either wait for that to happen or do a load test to prove it.

It's then a simple proposal of cleaning this to scale will cost X hours.

Jonno
  • 1,738
  • 10
  • 17
1

First determine the accumulated technical debt in your codebase. Then take a look at this question and answers, where it is explained how to convince management to pay off the technical debt before proceeding further.

BЈовић
  • 14,049
1

This is a tough situation to be in because from the user's perspective everything is at an acceptable and stable point now. Primarily with non-technical managers, there is nothing to be concerned about at the moment, but asking to rewrite the codebase is an enormous decision and one that should not be taken lightly, especially on the opinion and efforts of a single man (yourself).

So you are in a tough spot of trying to make a case for a rewrite because of overwhelming technical debt (in your opinion, we don't have any examples and have to take your word for it) as well as being in the tough spot of having the difficulty of maintaining and adding features into this system.

Your estimates for new features will be high, justify these high numbers with facts, proving that these things will indeed take a great deal of time. If you don't convey this properly then your manager may just assume you incompetent and you certainly don't want that. When he questions the high estimates then explain why you feel the accumulated technical debt is hindering the ability to quickly and cheaply add features to the current software. If your manager has two brain cells to rub together he will start to understand very quickly.

The point is that you should not try to convince your manager, but steer your manager with appropriate (and carefully selected) information that he/she can convince themselves that a rewrite is an acceptable course. You have to make the manager think it was his/her idea all along.

maple_shaft
  • 26,570
0

There is reason why all mature software looks like mess:

  1. All the mess is encoding the critical logic that the business relies on. Without it nothing works. Every bit of it was necessary to solve user problem.
  2. It's using slightly outdated tech. Current programmers seem to think that if it doesn't use some template magic, it's just a mess. This is broken view. Anyone coming late to any bigger project will have this stage while learning all the details.
  3. The requirements which were critical some time ago are no longer so critical. This is because the software already fixed those problems. Coming late to the project, it might seem like the software is complex for no good reason -- the problem no longer exists, but the complexity in the code is still there.
tp1
  • 1,932
  • 11
  • 10