I am working on a large website and having been thinking a lot about when I should be using a 3rd party API/Library and when I should be writing my own implementation from scratch. There is no Library out there that would incorporate all the functionality I need for my site but there are a number of libraries that would allow me to quickly implement different parts of the site's functionality.

I have a lot of programming experience and a good amount with PHP and Javascript, but I have never worked on anything this large. This is my own personal project and I know that to implement all of the functionality that I want from scratch would take more time that I would like to spend, but I would also like to keep my use of 3rd party APIs and Libraries to a minimum so that I can implement new functionality and fixes on my own without having to wait for someone else to release updates.

What are some of the criteria you use to decide when to use a 3rd party API/Library and when to write your own implementation?

6 Answers 6


I until recently worked on a large project, where we decided to use 3rd party stuff. In the beginning it worked fine. We got our stuff together. But as time went by, we discovered, that the libraries we used were too inflexible. We decided to replace the 3rd party libraries piece by piece with our own code, now knowing exactly what we needed and how to do it.

I left the project when we were nearly finished replacing all the 3rd party stuff with our own stuff. We got very far with the project in the beginning and had something working and running pretty soon.

Now, I work on a large software project in the company I am employed at. Our architect told me, that what ever we can build our-selfs is far better than the 3rd party libraries out there, well knowing, that it costs a lot of time (and money) to build something, that is already available.

My opinion is, that using 3rd party is fine for getting projects far in short time, but in the end, you should rely on your code. 3rd party libraries are often tested by a lot of people and sometimes not (depending on the source). If you work carefully and test your code, you can create everything you can dream of. Build your own little repository of snippets and classes and make them reusable. It will get you further in the end.

  • Thank you. This is almost exactly what I have been thinking. I would much rather rely entirely on my own code. I think when looking at libraries one of the main things I need to look at is. Is will it save me time in the short term, and will it be easily replaceable with my own code when I have the time and feel the need to replace it.
    – James
    Jul 10, 2011 at 17:53
  • 1
    I think it is worth noting that there is a big difference among third party libraries. For example, is it Microsoft owned library or is it Uncle Joe's one man show? Do you have the source code for it to maintain/modify if needed or not? Very important details... Jul 11, 2011 at 13:13
  • Dan, I have to agree with this. I have been thinking it is also important to note that in a library that is Uncle Joe's one man show, the code may not be very well maintained, cleanly written, or well commented. This also makes it much more difficult to maintain/modify , and really pushes me towards community-driven open source projects.
    – James
    Jul 11, 2011 at 14:24
  • Agreed. Today I found myself thinking that a persistence Framework we are using is totally worthless. It calls the database multiple times to make an update. I wasn't the original author of the code, that was handling the persistence on our side, but it is difficult to overview what goes on below, when you are short of the source code from the Framework... This doesn't help or make you faster in development. So I am going to suggest refactoring the whole persistence part, spending many hours on that. My motto is now: Do it once, do it right
    – Sören
    Jul 15, 2011 at 14:55

Reinventing the wheel is usually not the best idea. I create my own libraries if I want to learn the in's and out's of that particular code purpose, or, when I feel that it would be faster to write my own than to learn the 3rd party's if they have poor documentation or the library is known to be buggy. I use a 3rd party libraries as often as I can because I generally prefer to have sites online as soon as possible because that's how we make money.


I don't see the conflict. You write your own functions and classes, which incorporate, extend, or encapsulate those of the APIs and libraries you use. You add and modify code at will.

As you're doing this, if you see ways to abstract some functionality into a library of your own, you can do so.


I think almost always you should use external libraries if they don't conflict with the software license you are using. First, because they should make development easier and taking less time and Secondly because since they are used by a community, they have proven functionality. Final decision is up to you, though.


There's zero reason to start from scratch with your own library. The existing libraries incorporate thousands of hours of work and cross-browser compatibility. Pick the library that most matches what you want and suits your style and use it for everything it offers, then extend it to add anything you find missing.


As others have alluded to, I think a lot depends on your time schedule. If the object is to have something that works ASAP, it hard to beat 3rd party libraries. It's not an either-or choice either, you can certainly blend in your own code. I would stick with libraries that are well-established & widely used, because those tend to work well & are usually well-maintained.

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.