What are the ethical limitations of reusing existing code for a future, different client's project? I'm mostly thinking about generic low level code, not proprietary features, algorithms or designs. Assume no NDA was signed also.

For instance, if you were a specialist in writing code to create "Dynamic Widgets", and created a great Widget Factory for one client, is it acceptable to use some of the underlying widget code for another client that wants to make a non-competing Widget Editor. Lets assume that the second client hired you because you have such great Widget experience.

Further, if writing a Widget Editor from scratch generally takes 10 hours to piece together, but because you can reuse some of your past code it will probably just take 5 hours-- should you charge them for the original estimate or pass the time savings from the reused code you've previously written. This is for a project or task based estimate/cost given up front, not straight hourly timesheets.

3 Answers 3


This will borrow my knowledge from this question, because I feel a lot of the knowledge would be the same.

First off, from when I was a freelance web programmer, using PHP and MySQL (I do not do design), a lot of the code was fairly straight forward, even the custom stuff. When I did my research in how to do something, if I could see how it would help future clients, I would not charge the full rate of researching it, and would just add the cost to the next few clients who wanted that same feature. Everyone feels like a win-win.

Is it ethical? I believe to. My time needs to be paid for, but that's not the reason you're paying me. They're paying me for my expertise. There are only a few ways to add two numbers on a computer, the most common being x += 1. If I use this for Client A, does this mean for Client B, I need to use x = x + 1? Does not seem logical.

The main issue is that almost everything has been done. For those that haven't been done, you are probably not the first. If you come up with a method that adds two numbers together, is flawless, and works perfectly no matter how you implement it, it's stupid to not use it. All the clients I have dealt with understand that they pay me for my expertise, not my time. I know the process, I know what works, because as a freelancer, I am the expert in my field. This is the attitude to go forward with.

The client who pays by the project does not care if it takes 5 or 10 hours, they just want it to work. If you charge $500 for the Widget Factory component, and the first time it takes you 10 hours, you're billed out at $50/hour. If you can reuse it for the next client, while still charging $500 for the component, and you can re-use old code and have it working in 5 hours, that's $100/hour you're charging! You are getting paid for your expertise, not your time.

Does the client make you sign an NDA (Non-Disclosure Agreement)? Then check to see what it covers, hopefully with a lawyer. If it's just the general idea of the project as a whole, then you should be safe keeping snippets that help you out more. Ask before signing the agreement! The last thing you want is to get in hot water with a company that could put you through court for months at a time.

  • 2
    To add to Luke's answer: Everyone's reusing his own code or mostly someone else's code. :)
    – Peter MV
    Mar 11, 2014 at 18:45
  • Yea, even if I do a project with NDA, then another one not NDA, I still write from scratch most of the same code. Because I know that is how it works, they cant stop me from doing that. Maybe, in your contract you need to include that some of your libraries are licensed to yourself(or GNU/Apache) and if you can reuse them. If not, you just end up rewriting them based on your origin code.
    – WillyWonka
    Apr 10, 2014 at 22:04
  • So, Should I tell the client that I am going to reuse some code or just finish the work without telling him?
    – user702
    Apr 18, 2014 at 15:33
  • 1
    Either don't tell him, or be upfront about it. You need to run a business too, and you take time-savers that you know work, and you need to keep offering that to your other clients, otherwise you go hungry at night when you doublecharge for everything, and no one wants to use you anymore. It's business, and they're going to have to suck it up.
    – Canadian Luke
    Apr 18, 2014 at 16:08
  • In the US, you have to be careful about this because many clients will attempt to include contract clauses which state they own any and all code and IP that you developed for them. You need to explicitly state that you or your company retain all IP rights to the code and that the client receives a non-exclusive license to use it.
    – daaxix
    Jul 19, 2015 at 20:04

Here are the possible scenarios

1) If you contract to bill by the hour, then it would be unethical to do otherwise. Whether or not you re-use code (assuming you are legally entitled to do so), is a non-factor.

2) If you provide a fixed quote, then if you are able to deliver high-value for less effort on your part, you have every right to do so.

Both approaches are valid (bill by the hour or fixed-price) and re-using your code (provided you are legally permitted to do so) is a 'given' in today's world.

In fact, I try to find a happy-medium by passing on some cost savings, and improving my $$$'s made per hour, by taking the following approach with clients:

"I've done a similar project before and can re-use a lot of the code, so I can save you some money on the development."

Personally, my preference, as a freelancer, is 'fixed-price, fixed-scope' projects and I stick to that - so if I've done $50,000 worth of development work for one client, and it's going to take me 10% of the time, I'm not going to charge only $5,000 - I'd charge $12,500, and here is my rationale:

1) The client is only paying 25% of the 'full development' cost - they are saving significantly;

2) Your clients are in business to make money - so are you and you are not a 'charity,' you deserve to earn for your work and for the 'value' you provide.

(ASIDE: Of course, I make special exceptions for not-for-profits and charitable organizations - and help them out when I can).

On the flip-side, if I get a paid project to develop code that I know I'm going to be able to re-use and resell, then I might quote much lower than the actual 'cost per hour' to develop - it's a smart business move, because you've now added to your library.

You can then go to clients and say, "I've just developed this for client XYZ and I thought can provide these 'upgrades' to your site for a reduced a cost if you'd like to incorporate these changes."

Your a Freelancer and Entrepreneur - this is the name of the game - as long as you are being honest and transparent with your clients, there is nothing unethical about these approaches - it is understood that this is the way things are done.

It is also understood that building relationships based on trust is critical to long-term business success!

(CAVEAT: Use common-sense here. If you use this approach with a client's direct competitor, in my view, you are being unethical (and sleazy)), but for example, if you build a 'Store Locator' feature for client that sells Men's Gifts, and you have small chain 'Pet Stores' - you can safely use this approach).

Remember that, especially when getting into developing 'custom applications,' pricing is very 'arbitrary.'

Charge too little, and your clients are likely to not respect your level of expertise.

Charge too much, and your clients will feel like you are taking advantage of them.

If you can, try and have a frank discussion with the client of what they feel the project is worth - ask them! (you'd be surprised how often they throw out a bigger number than you had in mind) - and seek some consensus.

There is some 'safety' in charging per hour - lots of people prefer that - but you are limiting your potential to earn money - and being able to re-use code and use code repositories, etc. should enable you to earn much more overall - while delivering better value.

So questions like, "What was the budget you had in mind for this project?" are powerful tools in your arsenal as a freelancer who has to cost out projects.

If they name a price you're happy with, then just respond with, "Yes, we can do that," dig into your code library, make money and make your client happy.

  • 1
    So, Should I tell the client that I am going to reuse some code or just finish the work without telling him?
    – user702
    Apr 18, 2014 at 15:32
  • The best approach is to have a contract upfront, with these terms defined. You can have a contract which gives both you and the client the rights to code. I work with open-source code, so it's a given, but I always make sure the client is aware of it, the benefits and the implications.
    – NivF007
    Apr 18, 2014 at 17:01

I take a different view on this than a few of the current answers.

If I spot a general solution that can be enhanced and modified to implement a custom feature for a client I'll create (or enhance) a general solution on my own time and not bill for it. Maybe I'll throw it in a private Github repository. Generally, people don't have a problem if you include privately developed code (assuming you grant full usage rights, etc). You'd want to touch base on this concept early on.

Then I find myself in the position of owning yet another general productivity enhancing library snippet/tool that I can reuse in any project where it proves useful. Obviously, I'd only spend my own unpaid time developing this private library code if I thought it would provide value to me over time.

It is also possible to create the generalized library worthy solution after the project is finished by refining and rebuilding something not customer specific. The path chosen may depend on the scope of the effort involved.

While I consider the client paying for a solution I do not see them paying me to enhance my library at their expense. My library provides them an advantage in terms of development time and and in use of previously tested code that can be quickly integrated.

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.