58

I've noticed many questions on here from new programmers that can be solved using libraries. When a library is suggested, often times they respond "I don't want to use X library" Is it the learning curve? or ? Just curious!

10
  • 38
    Commonly known as libraryphobia, the fear of libraries.
    – Alex
    Aug 27, 2009 at 23:46
  • 19
    Not Invented Here syndrome. When someone is unsure of what they are doing, they are even more unsure of what someone else is doing when they don't understand it.
    – user177800
    Mar 3, 2010 at 17:28
  • 14
    code is harder to read and understand than to write.
    – peterchen
    Mar 3, 2010 at 20:45
  • 5
    @Sky: I had the discussion just today with a good, fairly experienced but still somewhat young dev. I don't know yet how "easier" could be defined better - maybe it's fun vs. boring. There are many "reasons" I've heard over the years: wrong language, wrong string class. When it doesn't implement everything, you have to write code anyway. When it implements more than you need, it's "overly complicated and convoluted". There's "so little documentation, it would take to long to understand the code", or there's "so much documentation, you can't find what you need". etc.
    – peterchen
    Mar 3, 2010 at 21:38
  • 1
    So many good SO questions get closed for being offtopic. :( It took 3 years for this one! :) Oct 9, 2013 at 22:05

40 Answers 40

111

A lot of new programmers are still working at a very low level of abstraction, learning the trade. That's something everyone has to go through. It takes a while to "move up the stack" so to speak.

Once programmers realise that they spend most of the time solving the same problems as someone else already did, and the goal is to realise "business value", then they can really appreciate the value a good library brings.

5
  • 15
    Well put, in my view.
    – Noldorin
    Aug 28, 2009 at 0:12
  • I disagree! Those who can achieve that stage are good developers; most won't. So you would see senior developers whose "are still working at a very low level of abstraction".
    – Graviton
    Aug 28, 2009 at 1:10
  • Sure, there are times where your senior guys are working at a low level... but those are the times where its worth their time to the business. Also, by Senior Developer, I don't mean people have been programming for a long time... Aug 28, 2009 at 1:55
  • 15
    You can also blame education. Lots of courses on writing a string class or writing a quicksort and the overall impression that using an existing library would be cheating. Apr 3, 2010 at 20:32
  • 5
    Going deeper on "using an existing library would be cheating": to get a computer science degree, I had to take many classes on how to write code, but none on how to manage libraries. If you can do the former, you can probably figure out the latter on your own, eventually, and there's only finite time in the classroom, so I'm not sure I'd 'blame' anyone for this. Fresh graduates have little experience, film at 11. :-)
    – Ken
    Jul 9, 2010 at 0:11
35

When you're still learning the ins and outs of a new language, also having to learn how to use a 3rd party library can look like too much work. Also, libraries tend to be badly documented - or at least have documentation that seems totally opaque to a new(er) programmer.

So, faced with trying to solve problem X, saying "use a library" can sound a lot like "solve problem Y THEN problem x".

(Also, their professors told them not to. I managed to get all the way though my undergrad in C++ without learning the STL existed. Boy, did THAT cook my noodle.)

5
  • I shudder at the thought of teaching C++ without assorted STL features. Without things like vector<> and auto_ptr<>, C++ is no safer to work with than C. Sep 2, 2009 at 14:04
  • 3
    LESS safe, I'd say, since it made so much less sense. Discovering the STL was mind-blowing. I've never been so happy to throw away hundreds of lines of custom code in my life. ("I didn't have to write my own hashtable? EXCELLENT! etc.") Sep 2, 2009 at 17:55
  • 2
    "libraries tend to be badly documented" - This is my main reason. At least in open source areas, libraries tend to be written in C with cryptic variable names and little-to-no documentation. Apr 3, 2010 at 20:11
  • What's worse, soemtimes the professors discourage such library usage just because of some issues it had 20 years ago. For instance saying "You should not use the STL or virtual functions in real code because they are too slow"
    – Earlz
    Apr 3, 2010 at 20:46
  • When I read libraries I found reading the source easier than docs, at least I can see what it's doing from the source in the case the docs have only function names.
    – quantum
    Jul 3, 2012 at 13:26
24

Some people, when confronted with a problem, think “I know, I'll use a library.” Now they have two problems.

Seriously - this is a reasonable way for a newbie, already overwhelmed by new language, programming environment, paradigms, keystrokes, etc. to react to the suggestion to use a library. If you've got a solution, but it's not working, there are many potential sources of error; sorting through them is a challenge. Adding to them can seem irrational.

"Use a library" means find the library, download it, install it in your project, and call the necessary function. Not hard, if you're used to it (and there aren't corporate policies against it, and you have reason to trust the vendor, and the library itself has minimal dependencies, etc.). But if it's all new to you, when you ask a programming question and get back a system configuration answer, it can seem unhelpful (even if it is not, in fact).

2
  • 4
    The hassle level of some libraries are simply not worth it for programs that will not use their full complexities. Often, it's like 4 days installing a library, reading the documentation, figuring out how it wants its input, and integrating it compared with 1 or 2 days with your own code, and you can write detailed docs for your own code... Jul 27, 2010 at 22:19
  • Yep, that was what my reason was, @carl.
    – anon271334
    Jan 20, 2011 at 9:53
18

Almost always it's because their professor has told them that they can't.

Sometimes it's just because they want to learn it themselves, but I'd say that's rare.

2
  • 1
    +1, no it isnt rare, but you are right(teachers are good example)
    – Cleiton
    Aug 28, 2009 at 0:46
  • 2
    great point, plus if you use library ur teacher should learn it also to understand ur code. teachers are not into learning new things, because they already know everything.
    – IAdapter
    Sep 2, 2009 at 13:12
13

It's the learning curve.

11

Using libraries is probably one of the worst things a learning programmer can do. Instead of learning how to code, they're learning how to use specific APIs that other people implemented. I'm not saying that every programmer has to understand every single thing that they use, but programmers who know the ins and outs of a computer (digital logic, assembling op-codes, etc) usually have an edge over people who've started with something like Java Swing and are just throwing together libraries.

In production, this is a different matter of course. But I think the best course of education is to 'make everything' once, at least. Writing my own web application framework from the ground up really improved my programming skills and abstract abilities. Doesn't mean I'll use that framework if someone hires me to build them an application, but I know the strengths, weaknesses, and reasons behind the things that the 'giant' frameworks use, and it can help me choose a particular framework for a particular situation.

1
  • I agree with this. It's definitely part of the learning process. Some are more hands-on than others. But I think once the budding programmer is comfortable with his/her craft, that's when order comes out of chaos (using libraries, creating libraries, using design patterns, data structures....etc). I'd bet that this is not something unique to software engineering. Aug 2, 2016 at 15:26
10

I remember shying away from several libraries simply because I wanted to see if I could create my own algorithm. I didn't want to just give up and let someone do the work for me but rather I wanted to learn from my mistakes. Once I had come up with a solution I was happy with, I looked into the libraries.

So for me it was simply wanting to see if I could do it.

1
  • 2
    That's the great thing about libraries, you can work on something until you reach the "Oh, my idea would work" moment, and then switch to using a library instead :D Jul 8, 2010 at 23:58
9

I always have this urge to do it myself, but sometimes I can see my own limitations. Just recently downloaded a library to create PDF documents, but thats pretty much the only time I can remember.

At least for me, (trying to) do things myself, is my way of learning.

My impression is that many newbie programmers wouldn't consider it their own work if they were to use someone elses libraries.

1
  • if you are using a compiler you are using someone else's work, does that mean we should all write in machine code only?
    – user177800
    Mar 3, 2010 at 20:51
7

I don't think that this is necessarily a bad thing. Using libraries is great; it saves time, effort, bugs, etc. However, you learn very little in the process, and for new programmers, learning is the goal. To answer the question, I think that they tend to shy way from libraries simply because they are not used to using them and perhaps they don't know that they exist.

2
  • You learn to use libraries, which is a valuable thing in itself. Nor is the problem that people don't know about libraries, but that they refuse to use them. Sep 2, 2009 at 14:05
  • 3
    Learning libraries is not all that useful for a beginner. Sep 2, 2009 at 17:08
7

For many poorly documented libraries that are either implemented loosely or in languages that don't allow you to control containment and visibility very well, it can be quite difficult to guess just how the library is supposed to be used.

After you've used it for a while, you've gotten used to the quirks or read other source code that taught you the right way; but until then it can be pretty irritating to use a poorly put-together/designed library. (or even a well designed one that isn't terribly well documented).

If you don't have the source code to the library, that's another problem--you have no control over the ability to keep your program working. This is much more rare these days, but still happens in the case of a purchased library.

1
  • A cursory glance at (some) of the Boost library documentation illustrates your first paragraph well.
    – J. Polfer
    Aug 27, 2009 at 23:56
7

Most of the points covered off (for me the main one is the learning curve) but one other I think plays a part:

Because learning about a library is less exciting than coding the same functionality yourself.

5

More libraries = less billable hours.

2
  • 3
    That's a very short-sighted vision, but it may hold true for less-experienced programmers. In truth what you should do is get past the re-inventing the wheel bit as soon as possible in order to provide true business value to your client (and they DO notice).
    – Esti
    Aug 29, 2009 at 3:49
  • 6
    Less billable hours means you can charge more per hour. Mar 3, 2010 at 21:10
4

I think there's a lot of time that needs to be invested in understanding the library's purpose - yes, a learning curve, but it's more that newbie programmers probably don't know what they need until they have a lot more experience.

4

Because it's fun.

3

Because part of maturing as a developer is learning to quickly identify problems which can be solved by a library or existing solution and which need personal attention.

3

When you're trying to learn how to do things, anytime something is accomplished "magically" by calling AwesomeClass.doAwesomeStuff(), you end up giving away a portion of control. When you are "new" and don't know what you're giving away or why it can be unsettling. This was my primary knock against Rails when I was first learning it. So many things just "worked" and I didn't know why without digging through lots of Rails source (which I generally didn't have time to do).

At least, that's my take on it.

3

The same reason that more experienced developers do -

Because it can often be as difficult to learn how to use a library as to write the part of it you need yourself. And at least then you can understand how it works when it doesn't do what you expect.

An experienced developer just has experience at understanding how to use libraries so more likely to consider it. An inexperienced developer it's one more thing to learn...

2
  • 2
    I'm pretty sure it's almost never as difficult to learn how to use a library as to write it yourself - it just seems like that when you start out because you're not aware of all the aspects of the problem, and because programmers always underestimate debugging. Aug 28, 2009 at 10:13
  • 2
    Don't forget that most third party APIs have features and requirements that you may not need. This can lead to API bloat and cause it to take more time to learn the API then to write a new lighter one. Mar 3, 2010 at 21:13
3

I'm a programmer, not a psychologist! :)

It was a long, long time ago for me, but it was because I wanted to learn and experience. I didn't want to use something I did not understand, so if I didn't think I understood the library and could program it myself, I tried not to use it. There might have been a bit of fear too; programming gives you a feeling of control, and using a library is like giving away this control.

3

Answer from a noob - "I am not sure how to use the libraries or even how to access them or how it works"

2

Libraries often come with the overhead of learning some API and it's paradigm. It can get complex fairly quickly, and I could easily understand that beginners would prefer something a bit more in their comfort zone. From my experience, I found most libraries & frameworks seem to do a great job abstracting some tedious routine, but when I need to either extend this functionality, or use it in a way that's not intended, it can be a handful.

I think it's one of those things where "practice makes perfect".

2

Well, the newbie's purpose might be more solving the problem than implementing a solution. Perhaps what they really want to do is figure out how to solve the problem. I mean, if they're still heavily in the learning phase, it's quite possible they don't want easy answers handed to them.

1

I think the professors want them to stick to the basics. When I graduated from under-grad school, I knew C++, Java and some other languages but had no clue about libraries and frameworks being used in companies. It was like do you know java..yes..can you write a servlet..no.

1

For speed demons they rarely use 3rd party libraries and new programmers are usually looking to squeeze every once of speed of of their code. I think if they don't have control over their code they can't get the performance that they are looking for. At least thats why i avoided libraries when I first started to program.

I remember programing my first DAL and avoided all the other free libraries out on the web because I wanted my code to perform at top speed. Later, I discovered that usually its not the code thats the bttleneck its actually the database.

1
  • 2
    A well-implemented library is likely faster than whatever code an inexperienced person is going to write. It is almost certainly more robust and has fewer bugs, and I don't think giving those up for the possibility of a little more speed is a good principle. Sep 2, 2009 at 14:13
1

Some open source libraries are buggy or not as efficient as others.

0
1

In my eyes another factor is that additional libraries add complexity. Programs tend to get harder to understand, harder to maintain and buggier when getting more complex. I think what makes especially new programmers shy away from libraries is that adding library code increases complexity more than adding your own code - simply because understanding how the library works is still out of their grasp. So it seems to be a problem of both skill and psychology.

2
  • Adding library code increases complexity less than writing one's own - for every other person that will ever touch the code. Only obnoxious prima donnas and newbies that don't know better yet will avoid libraries for that reason. Sep 2, 2009 at 14:07
  • 1
    I dare to partly disagree. If it's a small library doing exactly what you want and nothing more, you are totally right, but bigger libraries do add complexity and their contents are out of your control if you don't invest time reading their source code. If you only need a single feature it might indeed be the better choice to code it yourself instead of adding the code and complexity of a whole library. Regarding code quality, adding an established library to do the job might be better than tinkering on your own - especially if you're a newbie.
    – Kage
    Sep 3, 2009 at 10:24
1

I think more fundamental issues can be recognized as a deterrant to using existing libraries.

  1. Part of this as "newbie programmers" is a lack of exposure to libraries. If you don't know they exist, how do you know to use them?
  2. Number Of Options Available. Let's say I'm really interested in learning more about MVC, but if I have to choose between cakephp and smarty and zend and ... well you can quickly see the gears work to discover a way to achieve the goal without investing the time experimenting. Take a look at Freshmeat or SourceForge to get a better understanding at the daunting selection of libraries available.
  3. Questionable support combined with sketchy/outdated documentation for the libraries. Do I want to use this tool that may no longer work or may be abandoned in the future? It is likely that a project will evolve, and so it will for the project of a library too. Will its usefulness last the lifetime of my project or will I be required to re-do this work again?
1

Using a library requires you to understand the relatively complex design of the library, something that new programmers might not have mastered because all they've ever written is simple/procedural/single-purpose code. For example, to an experienced programmer standard design patterns like template method, observer and command seem pretty obvious, but to a newbie it all just seems like magic and/or unnecessary complexity. For me the turning point was when I got good enough to grok design patterns and write some basic reusable code.

1

It's been a long time now, but when I came out of college, I knew nothing of libraries. This was in the days of mainframes and mini-computers. Our college had a VAX and the managers were paranoid about students hacking the system, so didn't allow us to even see the library manuals. So, when I first came out of college, I didn't even think of libraries being available.

1

I am sure there are a lot of reasons why the newbie doesn't want to use the new library. But wouldn't this be a good opportunity, if you have enough time, to show them what the advantage of using the library is? With the people I work with, I will usually provide an example of why something is better than their approach. It helps them learn and mature as a programmer.

1

Happens that noobs use Libs without knowing, but when they must import/add one that is fairly less documented, there is a fear of unknow. That happens mostly for compiled langs!

In the interpreted, (or compiled IRT), mainly when there is a console, such fear is almost non-existent; since you can require and see if it fails, call a method and see what it returns.

Consoles are tools of bravery !

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