I'm trying to find out your decision rationale of when to do what. I'm happy to provide more context, but I want to make it general for now.
It's overly simplified I guess, but that sort of holds true as a general guideline:
In a Personal Environment
- Do I have fun coding it?
- OR do I learn something from coding it?
- Do I have enough time to code it?
If yes, then I prefer to write it than to buy it.
In a Professional Environment
If the total cost of ownership of the product (including development, testing, maintenance, support or any related expenses) is higher than the cost of the product, and that the calculated return on investment won't offset this cost, then you're better off buying it and moving on.
Things to consider for a make-or-buy decision
cost of development / cost for maintenance vs. cost of product / cost for maintenance contract: of course, that's the obvious thing, but that's actually not the only thing. For example, if I am going to use the software not only for my own company, but also want to sell it to others, then the calculation looks quite differently
Availability of a suitable product. For a lot of business processes, there is just no standard of-the-shelve software available. Or there is something available, but it is not suitable, because it contains 100 features from which you need just 3 in a slightly different manner, while 2 other important features are missing.
Does one want to get dependent from a third-party vendor? Especially smaller vendors provide you always with the risk that the vendor vanishes from the market in the future, or the further development of the product does not go in the direction you need. For a product you have under your own control, you can steer the direction of development much better.
When do I need a specific software, and what goes quicker: develop it on my own, or buying something, adapt it until it fit's to my processes and roll it out? Buying something from the shelve may seem the quicker and sometimes cheaper alternative, but I personally have seen also scenarios where developing a software exactly for the needs of a company, fitting to existing business processes, saved so much time compared to buy something and teaching several hundreds of users to do their work in a new and different way, that the cost of development were neglectable.
On a personal level, I develop on a weird combination of what I want and what would be interesting to write.
On a professional level, @haylem makes a good overall point about when to buy versus when to write. I will say that there is a huge element that is overlooked: opportunity. For larger companies it often makes sense, in my opinion, to custom write core line of business apps (not all line of business apps) when doing so makes the enterprise more nimble. There is an opportunity cost associated with buying software because then your enterprise (not just your IT) are locked into the vendor's way of looking at your domain.
For most things, it doesn't matter. Your accounting system had better not be creative. Your word processor will be just the same as anyone else's. But the things that make you you might be better written in house so that it can adapt to what it is that your business is trying to accomplish.
It is, as pretty much every other answer has said, a cost-benefits decision:
- What will it cost me in man-hours, materials, etc to give this project to a developer in-house, or an external contractor, to custom-develop? (usually high; counting their portion of overhead, plus salary and benefits, an experienced developer will cost you about a grand a day; maybe a bit more or less depending on the finances involved)
- What will it cost me to buy the known product off the shelf? (Depends on the product; general-use programs like text editors are typically cheap, even free, while specialized programs like circuit path design products can cost millions)
- What benefits will I get from a custom-developed solution? (Typically a custom solution is a closer fit to your business and thus can automate or at least digitize more of it)
It comes down to whether the cost, offset by benefits, of a custom-developed solution is less than the cost of the off-the-shelf product.
There are also opportunity costs to consider. Understand that these are not to be included in the real costs of developing vs buying, but in the wider world, you have to consider them. If your in-house development staff is working on this one project, they are not working on any other project; that means if there's another project on the list that is costing you money every day it's not done, it may well be a higher priority causing you to shelve or even cancel custom development and go with the off-the-shelf package. However, if not doing this project means your in-house staff is sitting on their hands, the developer cost is sunk; you're paying your development staff whether they're working or not, so it will cost you less overall if you're using them to their potential.
I'm assuming you are asking in a professional, commercial context, and that we're talking about a major part of your system rather than a single library.
Make or Buy vs. Make or Customize
There are situations when your organization can use an off-the-shelf product. For instance, few people would write their own word processor -- they use MS Word, or OpenOffice, or whatever. Same for spreadsheets. Note that you might "customize" your word processor with your own templates or macros, but people don't think of it as customizing. That's just "using" the word processor, as they see it.
It might be possible to use more complicated systems the same way, from webshops to ERP systems. But there will come a point where your designers or the business development people will want a change that isn't included in the standard. A redesign of the checkout page, perhaps, or a new way of calculating discount offers.
If you know that from start, then your decision is really Make or Customize. Just Buy is no longer an option. And even if there are no such requirements right now, do you expect your colleagues to come up with them later?
- Are you allowed to customize the system, beyond uploading your company logo in the right places?
- How difficult is it, and can it be done by your staff or do you have to contract it out to the vendor? Note that there are companies whose entire business model is to provide premium services for a free software they developed.