Overall I'm in programming for about 8 years now and it seems to me that I'm relying more and more on open source libraries and snippets (damn you GitHub!) to "get the job done". I know that in time I could write me own implementation but I like to focus on the overall design.

Is this normal (non corporate environment)? What could go wrong if my "programming" is nothing more than gluing different libraries together?

I know about "don't reinvent the wheel" but what happens when you don't invent a single wheel anymore?

  • 3
    Did you mean "non corporate environment", or an environment where people don't cooperate? Commented Jul 18, 2011 at 19:29
  • I thought the reason we write in interfaces and abstract classes is so our libraries are more universal, less dependent, more flexible ...
    – IAbstract
    Commented Jul 18, 2011 at 20:03
  • 1
    So bad, as a matter of fact, that Father's belt is coming off. Commented Mar 27, 2013 at 18:48
  • 3
    No, it doesn't make you bad programmer, but it doesn't make you a better programmer either.
    – user86752
    Commented Mar 28, 2013 at 13:03
  • 1
    I've been feeling this lately - I remember writing sorting algorithms in C++ using GCC, and feeling really satisfied when I echoed a sorted array to the console. Although I'm still programming, that feeling of "man, I just built something awesome from the ground up" isn't quite there anymore.
    – user26452
    Commented Jul 2, 2013 at 16:30

16 Answers 16


Using libraries instead of reinventing the wheel: Great! That's how everybody should do it. You don't get paid to do what's already done.

Using snippets: As long as you understand what you copy-paste, and as long as you invest the time to make it all consistent (instead of a patchwork of different styles and approaches), there is nothing wrong with it.

  • That's what I thought. Maybe I should start an open source project to get rid of this feeling :) Commented Jan 6, 2011 at 8:49
  • 26
    +1 from me. People should never use code that they don't understand. That goes for snippets and libraries.
    – user131
    Commented Jan 6, 2011 at 8:52
  • 6
    As far as snippets go I always rewrite the code myself just so that I'm confident that I know how it works. Libraries, I never rewrite unless it doesn't work for me for whatever reason. Commented Jan 6, 2011 at 12:29
  • 13
    Tim: Regarding libraries, I don't have to understand how it does something, as long as I know what it does. For example, many of us use crypto libs; I don't know how AES works, but I know what it does and when to use it.
    – user281377
    Commented Jan 6, 2011 at 13:38
  • @Rei Miyasaka It seems that Snippets are often of less quality than a standalone library. I, myself, got to refactor several part of snippets I used. Commented Jan 6, 2011 at 14:34

Coding is the lowest level of programming in fact. The higher level of abstraction you can get to, the better programmer you are. Choosing right libraries (not necessarily open-source ones), properly connecting them together and maintaining the construct is much harder yet more efficient and time- and cost-saving, than writing everything yourself.

  • From this point of view, a person that hires a programmer is a better programmer than him. He handles the highest level of abstraction: the goal.
    – Juan Perez
    Commented Jun 2, 2023 at 19:45

good programmers write good code; great programmers steal great code.

  • +1 for the line. Is it original?
    – apoorv020
    Commented Jan 6, 2011 at 9:53
  • I wish, no it's an odd adage. Commented Jan 6, 2011 at 10:32
  • I'm on my iPhone but I think it's a quote from Pablo Picasso (replace programmers with artists) Commented Jan 6, 2011 at 10:56
  • 21
    Picasso said Good artists copy, Great artists steal. Commented Jan 6, 2011 at 11:09
  • 3
    Great quote. Think I'll steal^H^H^H^H^H reuse it. Commented Jan 6, 2011 at 14:06

I love to write my own libraries. I also love to get my projects done on time. I think over time, most good programmers build up a collection of useful and re-usable bits. I don't know about you, but I get a great feeling every time I use a library that I wrote five years ago.

There is absolutely nothing wrong with using library code that has been tested and loved over time. You know how it works, you can count on its complexity and you can implement it quickly.

That being said, I'm assuming that you understand the code in the library. I'm assuming that, if given sufficient time, you could implement something of similar quality.

I know some really good C programmers who could implement the standard C library, a few of them that have simply as a learning / sharpening exercise. Some of the most fun I've had during hobby time was working on the C library in HelenOS.

So, there's nothing wrong with using library code, as long as you continue to be curious and learn. It goes without saying that you should not use code that you don't understand, unless your use of it is an effort to understand how it works.

  • You pretty much described my aversion against jQuery, +1. Commented Jan 7, 2011 at 1:52
  • Does someone else get to maintain your code? My college is reinventing the wheel with absolutely everything. Poorly tested, undocumented crap. Commented Nov 25, 2020 at 16:56
  • @wobbily_col Yes. Nothing where I've worked gets checked into main until it's, well, rather well-tested AND ships with tests. I wouldn't go writing my own XML parser (as an example) though, or work on solving any other major problem that was already neatly solved to what I needed. The whole "get done on time" really does narrow the space you have to play with. It sounds like you're working with folks that are doing it specifically for learning and experience, and I'd expect poor testing / documentation subsequently if that's the case.
    – user131
    Commented Nov 25, 2020 at 20:09

I'll go one better than some others in this question: I don't even think the "client" developer of a library needs to "understand" the code in that library.

I'm a (compared to some) relatively new iPhone developer. There are LOTS of libraries that I use every day that I could never have generated on my own, and the code of which is way over my head. Doesn't matter in the slightest PROVIDED:

1) I fully understand the interface to those libraries (I'm an ASIHTTPRequest ninja!)
2) I'm picking libraries that are in general, broad use, so I can be sure they've been well gone over and explored for problems (eg: ASIHTTP, Stig Brautaset's JSON library, Facebook's obj-c library, etc.)
3) Failing #2, it's simple enough that I could pick my way through it and find/fix/customize anything that needs finding/fixing/customizing.

That #2 is going to be the contentious part of this, I'm betting. The fact is, I am relying on the open source community, a community of developers that is certainly more experienced and quite likely smarter than I am. But that's the whole point of open source. So, there you go.


I'd like to throw in a warning for using libraries. As a frequent user of scientific libraries in Perl an R (and some in Java), I often had to hack into a library to avoid hideous overhead cost. Using libraries is great, but more and more libraries are themselves dependent on other libraries, which calls a third library that uses the standard library to do a rather common task. And each step in the process requires some checks of input and output. Quite a lot of those checks are completely redundant, but they weigh on the application nonetheless. And when used in a loop, then can start to weigh quite heavily.

Next to that, you can't be sure that libraries always keep back-compatibility, or do not contain bugs. In fact, all libraries contain a few bugs, that's the nature of code. Hence, the more dependent you are on libraries, the more potential bugs you enter in your code. And those bugs you can't solve yourself that easily without hacking into the libraries again.

Using libraries is a very smart decision, but if and only if you know the libraries and their behaviour pretty well.

I know, thinking hurts and computers are cheap, but still. Not thinking can hurt more.


Usually, copying large amounts of source code is poor practice. If the code was developed for another application at your company, then you should reuse the code by extracting it into a library to be used by both applications. You should not copy the code. Copying the code will force you to maintain two copies instead of one common copy.


Code reuse is a very good idea. It reduces redundancy and promotes maintainability.

The title suggests you are using the code as a library, but the text of your question implies you might be copying the source code into a new project. I'd stick to using other developers' code as a library as much as possible.

There is a problem if the code is bad or somehow broken or based on a model that doesn't fit your application very well. In that case it might be simpler to scrap some or all of the code and start from scratch than trying to understand why it was written in a given way. Keep the other code around for reference, though; you may come across an issue that you aren't sure how to solve. Chances are the other developer probably came across the same issue, and it's worthwhile to see how they solved it.

  • You got me there. I also refer to copying many lines of codes of other's work (not libraries), since it is legal in my case. What do you think?
    – Arman
    Commented Mar 27, 2013 at 18:40
  • 1
    @Arman It's still a good idea. From a maintenance perspective, it's not as good because when the original developer fixes a bug in his/her code, it's still there in yours. It's still better than nothing because at least the code is fairly similar across both projects and you could apply the bug fix separately without having to do as much.
    – p.s.w.g
    Commented Mar 27, 2013 at 18:44
  • :One last question: So as what Mason said, if for example I found that the 2500 lines of code (again I'm stressing not libraries) of yours is somewhat useful in starting my work, and you let me to copy it, do you think it's good for me? Is is ethical?
    – Arman
    Commented Mar 27, 2013 at 18:58
  • @Arman If it's legal, it's probably ethical too.If it's written by a developer under the same organization, then generally the organization owns the code and you have every right to use it (in accordance with organization policies). If was written under a different organization, you need to permission from that organization. Generally if the code is not covered by any license, the original developer doesn't really care how you use it, but I will always attribute the original developer in prominent code comments (with a link if possible).
    – p.s.w.g
    Commented Mar 27, 2013 at 19:06
  • 4
    Ideally, you should also understand how the copied code works. Commented Mar 27, 2013 at 19:32

That's generally a good idea, so long no legal issues exist.

However, make sure you take the time to understand what the library does and how it does it. Using a "magic" library to take care of things you don't understand is a good way to have some part of it blow up on you because you used it wrong, and then you have no idea how to fix it.

  • 1
    I wonder if "copying and pasting" a hundred lines of code made by my generous fellow programmer is still ethical.
    – Arman
    Commented Mar 27, 2013 at 18:32
  • 2
    @Arman: Try asking him. Commented Mar 27, 2013 at 18:32
  • 1
    If the licence allows it, why would it not be ethical? If you are trying to get a job done, and one wheel has already been invented and made available to you for free, it would wrong (i.e. unethical) for you to waste a minute of your time re-inventing it. If you need to learn how to reinvent a wheel, that's completely different.
    – Darius X.
    Commented Mar 27, 2013 at 19:13

Legally reusing code has almost no downsides and two huge upsides:

  1. It gets the job done. This is the more important one for professional development. Ultimately, you have a well-paying job because you know how to make things happen that would stump most non-programmers; reuse allows you reach that goal faster, so you become more valuable in your job.
  2. You learn stuff. This is the more important reason for self-improvement. There is no better way to improve coding than to read good code written by others. Even bad code written by others usually teaches you something! And there is no better way to understand how a library, API, language, or domain works than reading and improving solutions already written by others. Both things usually happen when you reuse existing code, because no pre-existing solution will ever do quite what you need - and the ensuing tinkering with the source is where the knowledge boost comes from.
  • That's really my goal, to learn. For now, it worth more than finishing my project. That's why I feel bad when trying to have someone's work with just little effort (not just referring to libraries).
    – Arman
    Commented Mar 27, 2013 at 18:48

Does heavy library and code snippet usage make you a bad programmer?

If you use libraries and code snippets in appropriate places, then 'No', it does not mean you're a bad programmer. It means that you're a smart programmer who can apply the wisdom of others in appropriate places.


It takes time to find libraries and code snippets, so if you can't write code on your own, and you need to spend hours to find libraries and code snippets to implement trivial tasks, then 'Yes', you are a bad programmer.


For completion purposes, allow a counter argument: http://web.archive.org/web/20150326134617/https://michaelochurch.wordpress.com/2015/03/25/never-invent-here-the-even-worse-sibling-of-not-invented-here/

a mentality that I call "Never Invent Here" (NeIH). With that mentality, external assets are overvalued and often implicitly trusted, leaving engineers to spend more time adapting to the quirks of off-the-shelf assets, and less time building assets of their own.

There is always a balance.


No. Programmers should use libraries which are already out there. No re-inventing the wheel. If you have a better method, you can go for it, else what does it really do in writing the same code. The only thing is you should know what the code is (and only if it matters).


In addition to the reasons in the other answers, not using the code (as long as it's a good fit for your problem) can be considered unethical because:

  1. You might be intentionally wasting your employers time OR
  2. You might be intentionally delivering a lesser product

Keep in mind, both of those are hard to determine beforehand.

Also, look at Not Invented Here, which commonly referred to as an anit-pattern.


I am for not using libraries unless absolutely necessary. Dependencies limit portability and lifespan. I have 34 years in software development and would like to have at least 1 of my programs last longer than 3 years without being destroyed by erosion (change).

COM (Component Object Model), the answer 17 years ago, in theory great, in practice questionable, reusable components not really, I will only use the very basic components and only if I have to.

APIs and SDKs not much use. If I break down the number of lines of code that I actual use out of a library, the time I spend getting them to work vs. writing them, I think it’s a wash. I quit using SDKs completely the overhead is extreme.

Frameworks: Zend, Silverlight, WCF, .NET, the layered systems, yes they can speed initial development, but when I hit their limits, the time I spend fixing the cracks, just isn’t worth the effort. How old are they and are they impervious to erosion?

I have gone to JavaScript and HTML with only my libraries. I have stripped JavaScript down by using only the most common statement types. I hope in 10 years I can write something that will last.

  • part of this problem isn't so much the libraries, but the continual technology churn of languages and programming tools that means you have to go and find new libraries in the new tech to do the same old thing.
    – gbjbaanb
    Commented Mar 28, 2013 at 23:34

It all depends. If you are coding a game then it makes since to use a library (ex. Allegro) but you can't really be considered a programmer if you're copying/stealing/borrowing (whatever) other people's code. I say no reinventing the wheel but to a reasonable point. Don't make your entire program of snippets that other people wrote. Sit at you computer and do it yourself...stop stealing code. People have gotten too lazy these days and just copy and paste.

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