7

I have been given a Drupal project from an external web agency and have been trying to becomer wiser on both Drupal and their approach of making a site. With time I've learnt a bit morer about Drupal, even though I've come to notice it really isn't my cup of tea. Recently, I tried to "simply" replace the HTML generation of a part of the site, which seemed to be generated through a custom module (their addons for the site). I changed that code and realised that the effect simply didn't alter anything, or at least I thought.

Basicly now I've without exaggerating replaced the same piece of code with very small differences 26 times, and it's still not changing everywhere. So what I'm dealing with is a set of code that have literally never or barely heard of global class nor function and is simply copy & paste'd all over the site.

I'm curious on what I'm supposed to do with this. There's one file alone that has over 3000 lines of basicly the exact same code 16 times over. If you order a web agency to develop at site, can you expect it to be common sence that the code should be at least a little maintainable and simply not a big piece of code, more annoying to edit than far more necessary, or does it specifically have to be requested and I should had instead had to validate the code before paying for the handover of the site?

This is the first time I have ever came across such a poorly written piece of code in my career and it feels as if we bought a good looking suit that we saw from the outside of the store, and all we got was a poster of that suit for the same price.

The question

What would be the appropriate thing to do in my case? Should I suck it up and convince my employer that the code is poorly written in hope that my given deadline for completing the project gets extended, or can I demand the web agency to do some action?

EDIT:
Thanks for all your answers! They help me get some more perspective on this. I will discuss this internally a bit more, and try to mark out the best answer, even though most of yours covers the same but also different fields of the question.

6
  • New programmers always think the previous ones screwed up the code base. They didn't. They knew things you don't know yet.
    – user1068
    Commented Jun 10, 2014 at 16:05
  • "There's one file alone that has over 3000 lines of basicly the exact same code 16 times over." is something I consider a screw up regardless of years in the business. Commented Jun 11, 2014 at 8:40
  • And that's something I've seen lots of good reasons for over the years.
    – user1068
    Commented Jun 11, 2014 at 15:55
  • I rarely see a valid reason to have the exact same functionality repeated outside of a function. The name function implies that. Or is copy and paste to get to lunch faster a good reason? I'm still confident that most of this work was poorly executed. Commented Jun 12, 2014 at 6:38
  • 1
    Repetitive code in my eyes is a quick fix for when you have none or few intentions to edit the solution in the future. Commented Jun 13, 2014 at 6:54

4 Answers 4

11

While I absolutely agree about demanding code quality, it IS very difficult to quantify, and if you have nothing in your contract with the agency then I don't see how you can get them to rework a presumably working solution.

Maybe the only thing you can take from this for the future is trying to come up with some kind of code quality control on top of your user acceptance testing when the provider deliver the solution.

If the code is really that bad, it may mean you simply do not hire that company again. There may be some mileage in informing the company of your concerns over their code quality, and in a bid to try and keep you as a customer, they may try and go above and beyond their contract, but your mileage will vary with this approach.

2
  • 4
    +1 for taking it back to the company. They (or the management) may be unaware of the poor quality. If they are unaware and do something about it, good! If they are aware or don't' do anything about it, fire them! (Don't use them again... and tell your friends :-).
    – Peter K.
    Commented Apr 24, 2013 at 11:58
  • 1
    Breaking up the issues and presenting them to the company made them clean up their code for me. There are still flaws, but it's more maintainable now than earlier. Commented May 27, 2013 at 7:47
7

I've had to deal with something similar when we outsourced some front-end coding (HTML/CSS only) to a "web agency". What came back looked pixel perfect like the mockups, but was copy-and-pasted all over the place. The agency explicitly knew that they were working on non final front-end code, which would be brought to life with some backend code and some additional Javascript later on. They knew the code would need to be extended and changed. Yet they still delivered a copy-and-paste result.

The bottom line is, you can go back to the agency and ask for/request changes. The agency is responsible for delivering what has been specified in the contract. But that's the clincher: if certain code qualities have not been specified upfront, they have no real obligation.*

First of all, it's very difficult to quantify "code quality". You'll need to come up with some metric for this before you can hold anybody to this standard. Maybe "time required to implement a new feature x needs to be below y"; but good luck quantifying or proving that. And if it wasn't already in the contract, it doesn't really help you now.

Secondly and more importantly though: if they delivered code in this quality to you it means they either have no idea what they're doing or, more likely, they are a lowest bid outsourcer with a number of code monkeys working for them which crank out code like an assembly line. They have no interest in quality and it would cost them too much to deliver high quality, custom code. Either way, you're going to be running up against one wall or the other trying to demand higher quality code. I'm not saying it's not worth trying, but it will probably be mostly unsuccessful.
If they're cooperative you may be able to micro-manage them into delivering a high(er) quality product, but whether this investment of time and nerves is worth it is questionable.


The only real way to get quality code out of a contractor of unknown quality or to cut your losses is to specify very regular feedback and QA cycles. Demand that during development you get regular insight into the code (direct access to the repository preferred, daily or weekly snapshots as a fallback) and assess it on an ongoing basis. Specify a payment structure that allows you to withhold payments if you see that the quality is not up to your standards; establish regular feedback cycles that allow you to specify areas which need improvement and require the vendor to implement that feedback lest you stop paying. In the beginning both parties need to feel each other out to some degree; you need to assess the vendor's quality and the vendor needs to get used to the client's demands. A contract which appropriately protects both parties against loss of time and money in case it doesn't work out is a necessity if you're working with new people. In the beginning this will incur some overhead on your part, but if it works out well and you've established some mutual trust you'll be able cut down on your part of the work and leave it up to the vendor.

It's kind of a red flag if a vendor does not agree to such a contract.

4

First: don't let the agency get any more work out of your project. That would confirm their business model (ie: hourly tasks given to junior devs for crazy money).

I guess from experience that they created some custom modules which suck and did not follow any of Drupal best practices. They may even have changed some core functionnality (like some custom made user modules) making you enable to follow the Drupal doc to create modules.

You will have to remove and refactor all this or this project is doomed. Your employer should suck it up and consider it a learning experience: web agencies are for small promotionnal projects, not anything with bigger scope.

1
  • Good input! The best I can do for the actual solution might be to remake the parts that doesn't make sence. Do you have any good site which learns these practices? I find the original Drupal site hard to learn from. Commented Apr 24, 2013 at 12:58
3

If the agency did terrible work the first time, there's every reason to believe that they will do so in the future. You might be able to talk them into doing more work without further payment (but I wouldn't count on it) and you might be able to supervise them closely enough that they deliver what you actually want, but that's highly likely to take so much work on your part that you might as well do the work yourself and save the time that would be spent on fruitless meetings.

Check the contract: if it was not clear in that that they needed to produce code that could be maintained and supported by others (i.e., yourself) then you just need to learn to write better contracts next time. If it was clear, consider legal action. And blacklist the agency, at least internally. Life is too short to deal with people who try to avoid their obligations one way or another, especially as there are plenty of others who are willing to deliver a quality product/service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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