Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've recently been promoted into managing one of our most important projects. Most of the code in this project has been written by a partner of ours, not by ourselves.

The code in question is of very questionable quality. Code duplication, global variables, 6-page long functions, hungarian notation, you name it. And it's in C.

I want to do something about this problem, but I have very little leverage on our partner, especially since the code, for all its problems, "just works, doesn't it?".

To make things worse, we're now nearing the end of this project and must ship soon. Our partner has committed a certain number of person-hours to this project and will not put in more hours.

I would very much appreciate any advice or pointers you could give me on how to deal with this situation.

share|improve this question
    
Much of what you describe is subjective. For example, Microsoft API's are full of Hungarian notation. What's wrong with it for plain C? I've found that its a lifesaver in the long run. Code duplication... ok probably a fair point. 6 page long functions... well it depends what they do. If for example I had to choose between a state machine in 6 pages, or in 1 page with 5 pages of functions being called (each only once), I'd go with the big one at 6 pages. Maybe they actually have reasons for doing what they do. –  quickly_now Feb 1 '11 at 11:05
2  
I have the impression that it's too late now for change, now that the deadline is nearing. –  LennyProgrammers Feb 1 '11 at 12:41
    
Does it work correctly? –  user1249 Feb 1 '11 at 13:18
add comment

6 Answers

If you didn't have any coding guidelines set at the start that they needed to adhere to I doubt that there is much you can do.

Unless of course the low quality is introducing security issues or just not working, checking for common security issues might be your best bet.

share|improve this answer
add comment

As @G3D noted, trying to save the project after the damage has been done is difficult at best. If someone from your company's part has already accepted (most of) the deliverables from the subcontractor, there may not even be legal ways to recover the losses.

If the subcontractor has met the predefined acceptance criteria (however low these were), then you lose. If you can find some issues there (i.e. the acceptance was not done strictly according to the predefined criteria), you might be able to put some pressure on them, and along with better defined quality assurance, get better quality. However, improving badly written code afterwards is always a huge task, taking a lot of time and effort, regardless of who does it.

share|improve this answer
add comment

You must:

  • Set quality requirement yourself. Quality is very subjective and then should be defined by you.
  • Do frequent code reviews by reading the code from the repository. That's your responsibility. Third party companies can't do the final quality review.

In addition to this answer, I suggest you to read this Tips for pitfalls of working on an outsourced project.

share|improve this answer
1  
"Set quality requirement": an excellent suggestion, but this is probably the core of the problem: how do you define "Quality"? I don't want to introduce metrics that can be gamed, and neither do I want to end up like the author of Zen and the Art of Motorcyle Maintenance :-) –  lindelof Feb 1 '11 at 14:16
    
Oh yeah you are right, there is no perfect system, answer, anything. It's better to set quality requirement than not setting quality requirement ;) –  user2567 Feb 1 '11 at 14:54
    
And when you contract work out (esp for a fixed price) and then demand changes "to make something that works look the way you want" you find the contractor getting very unhappy at additional unscoped work. Even setting the standards beforehand, its REALLY hard to impose your way of doing things. –  quickly_now Feb 1 '11 at 22:38
add comment

I think it's more of a business/management/legal issue, and not really related to programming. Imagine you sell a product, and your partner delivers the packaging for this product. What can you do if the packaging is too bad?

  • Negotiate with your partner to deliver something of a higher quality,
  • Change your product to try to adapt it to the low quality of what is done by your partner,
  • Sue your partner.

In the last case, you can do it only if the contract was precise enough. For example, joining quality & style requirements to the contract is a good idea to avoid this sort of problems. For example, I work in a company in which coding style and quality is very important, so when we deal with subcontractors, the contract always precise that FxCop and StyleCop compliance is mandatory (for C#; we also have our coding standards for CSS or HTML code, etc.), and any code which is not compliant will not be accepted.

If there are no such thing in your current contract, well, you can't invent quality & style guidelines now, and force your contractor to use them.

So you stay with two other solutions. If you have a strong position compared to your partner, you can negotiate a higher quality code. Or, in all cases, you can ask to deliver a better work for more money or other advantages, or spend some time enhancing the existing code on your own.

share|improve this answer
add comment

You don't say how you have to use the code. If you can mostly just treat it as a black box, how it's written is not currently important. If you have to modify it, you've got more problems.

Is your partner still responsible for code functionality, or are they completely off the hook in case of bugs or missing features? Does it do what it's supposed to now, regardless of how ugly it is? How likely is that functionality to change in the future?

Under the circumstances as stated, you're going to have to get things ready to ship, whether you like it or not, and you know better than we do what that entails. For the future, can you be involved in the contract negotiations?

share|improve this answer
add comment

Ask 3rd party why they implemented that way, try to learn what motivations they had in doing what they did, if their reasoning is ok, explain them your approach and practices your company follows.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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