I'm working on a project as a freelance web developer. Apparently I am the fifth dev in 1.5 years to work on this project.

The web app has fairly low complexity. It is an online assessment. User registers, requests & pays for assessment, answers questions, gets results as a PDF.

The code base is pretty treacherous. I have no idea who the previous contributors were, but can identify one fellow as doing good little but excellent work, one distinguished fellow who messed a lot of stuff up, and the other two are indistinguishable.

The software design is extremely inconsistent. Many functions are deprecated or very poorly written. The database has many unnecessary tables and fields. Generally speaking there is a lot of cluttered and redundant code. Some parts literally look like wrong answers to practice questions from PHP 101.

About 70% of desired functionality exists, which makes it seem okay, but it isn't okay. There are a lot of little bugs that she may be used to by now. I can't see this selling like hot cakes any time soon.

I honestly think I could rebuild it from scratch and have it be in better condition in about 30 hours. I have logged 31 hours on it, only 2-3 hours spent making new functionality updates.

The client has been so patient through this time, has spent a lot of money on it, and has $0 in return. It is still not in production and needs a payment system installed before she can do what she wants with it. (Thank heavens I'll be doing that.)

Should I continue to patch the broken material, or suggest to her that we start from scratch? Or is this a flaw in my own skill as a developer that I can not just go in and make it work?

I have been very honest with her through the entire process and I think she trusts me. I would be willing to go as far to say that if after 30 hours she is not satisfied with the progress, the rest of the work is done at half my billing rate.

  • At the core this is more of a software development / project management question and that's not something we can answer. If you decide that you should start from scratch, we can provide answers on how to best communicate this to your client. But we can't tell you how to do your job. But that may also be a better fit for Freelancing. – Lilienthal Jan 24 '18 at 7:51
  • Make absolutely sure you are aware of potential edge cases that the existing application deals with. This is the hardest part when starting from scratch; the client will not provide you all constraints a priori. Incidentally, dealing with edge cases is also what might cause architectural rot in the first place, so there's a plausible chance that what you imagine to be a clean reimplementation will at the end look a bit like the original mess ... – pmf Jan 24 '18 at 8:32
  • " The database has many unnecessary tables and fields" are you sure the other developers my have denormalised the database for performance reasons. – Neuromancer Jan 24 '18 at 9:29
  • I once did some contractor work on a web application where users registered, paid for an assessment and then got their results as a PDF. So my heart was in my mouth a little as I read this until I got to the part where you mention PHP, and then I sighed with relief because mine was all ASP.NET. I'm in the clear. – Jonathon Cowley-Thom Jan 24 '18 at 17:14

Professionals do not

say that if after 30 hours she is not satisfied with the progress, the rest of the work is done at half my billing rate

You make an analysis of the job and give options, estimates and recommendations.

One option would be to rebuild the whole thing with an estimated timeframe of 30 hours.

You should have done this 25 hours (of work) ago.

Most professionals I know would be very reluctant to take on a project that only works 70% and would negotiate for a full rebuild instead in the first instance precisely because scenarios like yours will probably occur. If the original work was solid, they wouldn't be hiring you.

| improve this answer | |
  • 25 hours of work ago I didn't realize the state of the code base. Sure, it seemed a little sloppy, but you can't read the mechanics of a system without spending time with it. – user77432 Jan 24 '18 at 6:23
  • You would know best, so do it now that you do understand better. – Kilisi Jan 24 '18 at 6:25

It's all a matter of cost-benefit ratio and how you sell it to the customer. You state that 70% is done at this point, estimate how long it will take you to implement the remaining 30% given the current code base (including fixes) and if you did the rewrite. If the remaining 30% would take 60 h now and about 9 h after the rewrite (assumed 30% of the 30 h) it would be a good deal for the customer, but it's up to you to sell it.

Is there any way to refactor the existing codebase to get in a better shape? This could be an option, if there is a way to test the existing code.

Remarks: You have to be very confident, that your assumption is sound. We tend to underestimate how long these things take and it will cost you or your customer (depending on if you are selling them a fixed price or an hourly package) much money. Furthermore the existing code-base may already contain fixes and corner-cases that you're not able to foresee at this point, which might consume additional time. Last but not least, you should consider the pareto principle. If the remaining 30% consumed 70% of the time for the project, it would not be 9 h, but 70 h.

| improve this answer | |