Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

migrated from stackoverflow.com Jul 11 '11 at 8:34

This question came from our site for professional and enthusiast programmers.

6 Answers

up vote 3 down vote accepted

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 libaries we used were to unflexible. We decided to replace the 3rd party libaries 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 libaries 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 libaries are often tested by alot 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 reuseable. It will get you further in the end.

share|improve this answer
    
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 '11 at 17:53
    
+1, explained it better than I did. –  jcomeau_ictx Jul 10 '11 at 18:08
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... –  Dan McGrath Jul 11 '11 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 '11 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 '11 at 14:55
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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