0

If you talk about a library to any computer programmer today, the image they will most likely conjure up is of some software package, a body of helpful and reusable functions they can link and call to achieve certain tasks. Not likely, the original meaning of the word - that big, ugly building that is home to tons of books!

Yet, if you think about it, there is hardly any similarity between the two, a function or module is a very appropriate engineering term. The only common point is that they are both helpful reference points. But then, programming libraries aren't just "read" like books, they are integrated, called and acted upon to do one's bidding. Besides, a programming library can be compared to many other things too such as a factory, warehouse, robot, helper, assistant, supporter, etc. Each of these can equally be substituted for a programming library and the meaning won't alter much. So, why was the word library chosen to describe such projects?

  • 1
    A library is a room with a bunch of shelves, and the shelves are filled with books on different topics. Do you not see the analogy? – Hot Licks Jan 12 '17 at 13:26
  • 1
    (And keep in mind that originally a computer program library was a bunch of punched card cabinets filled with decks of cards.) – Hot Licks Jan 12 '17 at 13:27
  • Without the books there is no library. The basic meaning of library is a collection of books; it was extended to include film, so you have film libraries. The extension to "an organized collection of routines" is natural. A library also lends things, a warehouse generally doesn't. – AmE speaker Jan 12 '17 at 16:36
  • Finally found a reference for what I was looking for. You should be able to follow this which ever way you need to take it. From 1968. "This is the CDC utility that manages something called a Program Library. Its idioms are rooted in the punched card technology of the time, but what it does is to allow a repository to be updated by correction sets and to be the source of input to compilers or other tools in the development chain." rc.xqwv.org.uk/2014/update.html – Phil Sweet Jan 12 '17 at 17:36
3

In the early days of computers, when mainframes were pretty much the only option, hierarchical directories such as we find on modern computers were not used very much, mainly because the algorithms for directory maintenance were very inefficient, especially when directories contained a large number of entries. For this reason, source files and object files were often stored in what were called library files, or just libraries. (They were something like archive files that are used today.) The directories of these files were implemented in various ways, sometimes using ISAM (indexed sequential access method).

With the advent of efficient B-tree pruning algorithms, source and object files can now be stored directly in system directories without any impact on performance, but such collections of files are sometimes still referred to as libraries.

  • 1
    In the early days of computers "libraries" were decks of cards in filing cabinets. – Hot Licks Jan 12 '17 at 14:06
  • That too. The keys to our card cabinets had all been mislaid long before I joined the company. Occasionally, some idiot would press the the button that locked an entire cabinet. My services were often called upon to pick the locks (rather than get security to locate the master key, which pissed them off no end). It wasn't too difficult (using a couple of paper clips) -- anyone could do it, but I gained a certain reputation within the company, apparently. – Mick Jan 12 '17 at 14:11
  • @HotLicks Don't forget paper tape -- much more reliable than punched cards. – Mick Jan 12 '17 at 14:15
  • Yeah, I once demonstrated to our security folks that a standard desk drawer lock could be picked with a paperclip. And it was fairly common to wrap the lock button on filing cabinets with about 10 turns of masking tape, to keep the thing from being locked. – Hot Licks Jan 12 '17 at 17:38
  • As to paper tape, at one time I had some rolls of paper tape, containing various programs, et al, stashed away and they turned to dust. But the card decks I had were still in pretty good shape. (Of course, I haven't seen either in 20-30 years.) – Hot Licks Jan 12 '17 at 23:47
3

The people who first defined the terms used in programming languages were largely academics, and so probably had a more positive and familiar association with the word "library" than you seem to. I would suggest the association such folk would have with library, rather than "a big ugly building full of books" might be something like "a collection of works which allows us to gain from the knowledge and wisdom of others, and use it to progress yet further". But that's just the romantic in me...

For me it seems like an obvious analogy: a library refers as much to the collection as it does to the building itself.

For example:

Cambridge:

a collection or set of books or other things, all produced in the same style or about the same subject:

Dictionary.com:

a collection of manuscripts, publications, and other materials for reading, viewing, listening, study, or reference.

Merriam Webster:

a : place in which literary, musical, artistic, or reference materials (as books, manuscripts, recordings, or films) are kept for use but not for sale

b : a collection of such materials

For this reason the use of library in the context of a music library on an mp3 player has never scanned as odd to me either.

So what is a library in computing? According to wikipedia, a library is a collection of configuration data, documentation, help data, message templates, pre-written code and subroutines, classes, values or type specifications. That seems like a good definition to me.

Generally the pre-written code and classes are the most important parts of that, and classes essentially boil down to pre-written code containing class definitions. What happens when I use a library in my code? The compiler/interpreter reads your code, and where you include a function from the library, it references the text of that function and executes it in your code.

Since this isn't stackoverflow, I'll use a simple pseudo-code example

-----------------------------------
##include Arithmetic_library
x = 2
y = 4
z = AVERAGE( x , y )  
PRINT z
-----------------------------------
Output=3

This AVERAGE function refers to a library, which contains a function as follows:

FUNCTION AVERAGE(arguments)
    total = SUM(arguments)
    count = COUNT(arguments)
    answer = total / count
return answer

So what does the interpreter do upon reading my code? It reads from the library. I would argue a library is a better analogy than the alternatives you provided for that reason: a library contains materials (whether books or films or audio etc.) to be referenced, and the information inside them used constructively and creatively. That is exactly what a library is in coding.

As to your proposed alternatives? A warehouse is a collection of things for storage. A factory is something that produces a limited number of well defined things (more like a subroutine if you want a coding analogy). A helper, assistant or supporter don't fit either, they imply an intelligent entity which offers you advice, a library doesn't do this, in fact it doesn't do anything, it merely is, and allows you to reference or use its materials as you please.

Another analogy that might work for instead of "library" is perhaps a "toolbox", and indeed many programming manuals informally refer to libraries as such. As to why library has taken off as the accepted term? The fact that a computing library is, at the end of the day, a large collection of useful written text rather than of physical objects, lending itself to the use of the term "library" rather nicely.

2

This is a computer program library:

enter image description here

It contains decks of cards (multiple decks per drawer), each deck representing one method/procedure that might be incorporated into your program.

  • n​i​f​t​y​!​ – Some_Guy Jan 12 '17 at 15:15
  • Cool! This could be easily mistaken for lockers/cupboard-drawers of today. – Prahlad Yeri Jan 12 '17 at 15:58
1

I believe it comes from the days when higher level program languages were in their infancy, just before actual compilers came into being. Special punchcard machines were used to convert an abbreviated source-code into a full length executable program. They amounted to flowchart converters. They are called static libraries today.

the following quote assigns the word to the idea, but I'm still looking for an early 1950s actual usage.

A true visionary, Admiral Hopper conceptualized how a much wider audience could use the computer if there were tools that were both programmer-friendly and application-friendly. In pursuit of her vision she risked her career in 1949 to join the Eckert-Mauchly Computer Corporation and provide businesses with computers. There she began yet another pioneering effort of UNIVAC I, the first large-scale electronic digital computer. To ease their task, Admiral Hopper encouraged programmers to collect and share common portions of programs. Even though these early shared libraries of code had to be copied by hand, they reduced errors, tedium, and duplication of effort.

http://www.cs.yale.edu/homes/tap/Files/hopper-story.html

-1

This use of the word library in a computing context is a Metaphor.
This is not really surprising, since virtually all computing terms are metaphors.
As it says here,

"... computers were straightforwardly designed to be metaphors. The original impetus behind computing was the attempt to subcontract human brain labor to a machine by building a sort of a model of what the brain does in calculating. This led, in turn, to a whole new set of experiences with computing and the consequent need to talk about them.

"But because there were no traditional ways to talk about these new experiences, the entire computing enterprise became a hothouse for metaphors. Exotic blooms are continually being pulled in from elsewhere and assigned new metaphorical meanings:

  "editor, spreadsheet, file, folder, hacking, jump drive, slide show, the Net, the Web, spam,
    surfing, overflow, virus, worm, cut-and-paste, cyberspace, garbage, troll, wizard, ...

    the list goes on."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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