Tell me more ×
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.

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 cooperate environment)? Does it make you a bad programmer if "programming" is nothing more than cluing different libraries together. Feels like it.

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

What's your take on this?

share|improve this question
2  
Did you mean "non corporate environment", or an environment where people don't cooperate? – Bryan Oakley Jul 18 '11 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 Jul 18 '11 at 20:03
Heavy library and code snippets (from great programmers) usage makes scopes to be great programmer. Because by usage, we can learn from them practically. – Mahbubur R Aaman Mar 28 at 12:17
1  
No, it doesn't make you bad programmer, but it doesn't make you a better programmer either. – Stanislav Mar 28 at 13:03

10 Answers

up vote 65 down vote accepted

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.

share|improve this answer
That's what I thought. Maybe I should start an open source project to get rid of this feeling :) – Henrik P. Jan 6 '11 at 8:49
14  
+1 from me. People should never use code that they don't understand. That goes for snippets and libraries. – Tim Post Jan 6 '11 at 8:52
2  
+1 absolutely right! Good answer. – Tim Krueger Jan 6 '11 at 8:53
4  
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. – Rei Miyasaka Jan 6 '11 at 12:29
8  
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 Jan 6 '11 at 13:38
show 3 more comments

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

share|improve this answer
+1 for the line. Is it original? – apoorv020 Jan 6 '11 at 9:53
I wish, no it's an odd adage. – dan_waterworth Jan 6 '11 at 10:32
I'm on my iPhone but I think it's a quote from Pablo Picasso (replace programmers with artists) – Henrik P. Jan 6 '11 at 10:56
13  
Picasso said Good artists copy, Great artists steal. – dan_waterworth Jan 6 '11 at 11:09
1  
Great quote. Think I'll steal^H^H^H^H^H reuse it. – Wonko the Sane Jan 6 '11 at 14:06
show 1 more comment

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).

share|improve this answer

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.

share|improve this answer
You pretty much described my aversion against jQuery, +1. – eBusiness Jan 7 '11 at 1:52

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.

share|improve this answer
+1 Really like your answer Eugene. – Henrik P. Jan 6 '11 at 9:15

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
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 Mar 28 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.

share|improve this answer

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.

However...

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.

share|improve this answer

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.