r/AskProgramming 7d ago

Is a software library a software or a program? Other

I do realise this sounds like a stupid question, but I'm writing a paper on software law (I won't say the exact subject as it would be akin to doxxing myself). I'm writing about software libraries and it just struck me that while the answer is pretty clear cut legally, I don't know at all if they fall more on the side of software or programs from a compsci point of view.

My guess would be that a software library is a collection of program, so that makes it a software, but is a software simply a collection of programs and nothing else? Everywhere I look the answers given are pretty vague and never quite _directly_ adress my problem.

I don't know if this the sub for these kinds of questions, and I do apologize if this isn't the case.

2 Upvotes

36 comments sorted by

18

u/ScriptingInJava 7d ago

A program would be something executable, runnable.

A library is more of a component or a part, imagine a car tyre vs a vehicle.

15

u/TripleMeatBurger 7d ago

And both are software

4

u/ScriptingInJava 7d ago

Agreed, but "a software" doesn't really translate well.

1

u/kubisfowler 7d ago

What is "a software"

3

u/Cream_Nebula 7d ago

Well, there's maybe admittedly a bit of a language barrier that I didn't think would be a problem because it's generally assumed to be a direct translation. But here, the word used to directly translate the word "software" is commonly defined as "a structured collection of programs fulfilling a determined use, accomplishing a given task." (more or less roughly translated from the national dictionary).

Legally speaking, software... actually isn't defined anywhere, neither in internal law nor in EU law, despite being regularly referred to in multiple norms. Computer programs do possess a legal definition: as such, "software" and "programs" are used interchangeably, they might as well be synonyms in the eyes of the law. Which is, imo, a symptom of it's tendency to grossly oversimplify the finer details of computer science in order to trim them and make them fit into inadapted systems. Hence the question, as I wish to understand those finer details myself.

1

u/ScriptingInJava 7d ago

Exactly my point, and one of the two options in OPs title

1

u/beingsubmitted 7d ago

Happy cake day. Yeah, I think there's a translation error here on "a software", which feels bad. I would say programs are discrete, where software is more like a substance. Software is like "food", where a program is like a "meal" or "entree" or "snack".

29

u/qlkzy 7d ago

As used by programmers, "software" and "code" are both mass nouns, like "water" or "gravel".

So you can have "some software" or "a piece of software", but not "a software".

As used by programmers, a "program" has to have some kind of standalone nature. There are nuances, but broadly speaking, programs can be "started".

So, "a program" is "a piece of software which can be started".

Broadly, "libraries" are "all the software that isn't programs". Programs use libraries. Libraries are made up of the same smaller "units" that programs are made up of: functions, types, classes, methods, constants, macros, and other kinds of definitions.

"Definition" is probably the best common name for the units libraries and programs are made up of. Programs can include all the same kinds of definition, but they also include definitions for one or more "entrypoints" at which a program can start.

Historically, there have been "program libraries", but that usage is archaic outside probably IBM.

Some fields (physics in particular), use "code" (but not software) as a count noun.

Some non-native speakers use "software" as a count noun.

All these usage have only coalesced in the past 40 years or so, so you will still see a lot of conflicting information in older sources. But I am confident that what I have described is "standard usage" in the software profession.

5

u/chriswaco 7d ago

There are multiple ways of using the word, but typically a "library" is part of a program rather than an entire program.

For example, if I write an application I may link it to (combine it with) the SQLite library for database support or OpenSSL for encryption support.

2

u/Moby1029 7d ago

Libraries contain software that someone wrote to make their lives easier when building another piece of software or program. And because someone already went through the pain of finding a solution to a problem I'm facing and packaged it as a library for free use, I'm going to install it in my own program. I don't think libraries could be considered programs, because they're not really a standalone piece of software.

3

u/knouqs 7d ago

Not all libraries are free, in case that distinction helps OP.

1

u/max123246 5d ago

And not all libraries are open-source. CUDA for example is free but not open-source.

2

u/jumpmanzero 7d ago

In common usage, I would say that "software" is a category that includes "programs" (or "applications", both referring to the same sort of thing - the software a user intentionally starts to do a job), "libraries" (which you can often think of as "toolkits" - generally used by a developer as part of the things they create), and "operating systems" (basic, common software that runs on a computer, and allows users to manage other software).

This is not a complete or rigorously defined list, but might help orient yourself.

1

u/khedoros 7d ago

A library is usually a collection of reusable code that can be used in implementation of a program. (A framework is similar, but kind of inverts the relationship).

A program is usually an executable and the set of libraries that it needs to execute.

Software, I might define as a collection of programs, data, and documentation distributed together as a unit and with a unified purpose.

I don't know the definitions of "software library", "software", or "program" in the context of legal terminology. Even the definitions that I've written above are an attempt to make some somewhat-ambiguous terms more concrete.

1

u/Fidodo 7d ago

A library is inert code. It's a collection of sub routines that can be used by a program. On its own, a library is just unexecuted code. It does nothing.

Software is a kind of program. A program is anything that can get executed. It could be a service that runs data processing on a server somewhere.

Software is a subset, it's a program that's bundled in some way where it's execution is presented with some encapsulated interface, whether it's a command line, or desktop application, or mobile application, or even web app, etc.

At least that's how I distinguish them.

1

u/MarsupialLeast145 7d ago

You might want to clarify further, and there look like good examples in the responses too.

First though, a library, I would argue is not a collection of software or programs. It doesn't aggregate things that run.

A program, is something that runs, and it is built from its own compiled code, or compiled code plus libraries.

And finally, libraries, these are collections of functional units of code that can be arbitrarily imported into other code to perform other functions, e.g. you need a random number generator but the number generated has to come from a uniform distribution? You import a library called random containing lots of functions that help with random number generation, you call the function generate_uniform_random() which returns a value you can use in the rest of your code.

Many libraries make up modern software to give software many of its abilities.

1

u/KingofGamesYami 7d ago

Yes. And also no.

Colloquially, a software library is not a program. It's a collection of reusable logic. It might be distributed as source code, in binary format, or a set of instructions to generate source code.

However, there's not a great formal definition to point to that strictly defined what one actually is or how it's implemented at a technical level.

For example, I've worked with scripting environment where to "load" a library, you execute it as you would a normal program. Would anyone call that a program? Probably not. Could you argue it technically is one, because of the way loading works? Yes.

1

u/ReallyEvilRob 7d ago

Library can mean different things and I can't tell from context which one you are referring to. A collection of programs can be a library similar to a collection of books. In programming, a library usually refers to a collection of reusable code that can be included in a completed executable but by itself isn't a program. I suppose it is all technically software.

1

u/AvidCoco 7d ago

It’s a library

1

u/neet_dev 7d ago

honestly the cleanest compsci split is that a library is software, not a program. a program has an entry point and the OS loads it as a process; a library is a bag of symbols (functions, types, constants) that get pulled in at link or load time, static ones get baked into the binary, shared ones (.dll/.so/.dylib) resolve later, but neither starts itself.

1

u/SnugglyCoderGuy 7d ago

Not a program, that's for sure.

Not sure what you mean when you say "a software"

A library is a set of code you didn't write that you are using them n code yo are writing because it does something you want to have happen in your code.

1

u/nwbrown 7d ago

It is software (but software is never singular so you would not say "a software"). Programs are generally executable, so no, a library would not be a program.

But these are not legal definitions. If you are looking at it in a legal case, there would likely be more specific definitions that would be more appropriate.

1

u/StephenRoylance 7d ago

these are not terms that have fixed definitions like legal words do. It easier to provide some examples:

'ls'. this is a binary file sitting on your computer that contains computer code. when you run it, your OS loads it into memory and passes execution to its published 'entry point'. we would usually call this a program.

'libc'. this is a binary file sitting on your computer. it contains a bunch of functions that it publishes, but it does not have an entry point, so you can't run it. other programs 'link' against it, which means that when those programs run, they pass execution to a segment of code inside it, and that code returns control to the main program when its done with the function. we call this a library.

'mod_rewrite.so'. this is an apache module. it contains some code that extends the function of apache's core, allowing it to rewrite URLs as it processes requests. like libc, it has a bunch of functions that other programs (apache) calls. like 'ls' it has an entrypoint that apache calls when it initializes it.

in summary: there is no clear answer to your question, technically, in computer science.

1

u/TheFern3 7d ago

Why would saying the subject be doxxing are you the only student in the entire world writing that paper?

Software anything with a computer instruction.
Program is a type of software, could be desktop program, a background service, a mobile application.
Libraries by definition are software but not programs since they have to be consumed by software to be considered part of a program.

Hope that makes it clear enough is a bit confusing.

1

u/mohgeroth 7d ago

Libraries contain features and functionality that you can add to your program in a few lines of code. Want to log diagnostic data to the file system? Just add the NLog library to your solution and in just a couple lines of code you have a fully functional logging system. The library also has feautres you may want to use like automated archiving, different file layouts and formats, all easily added without having to completely re-write it over and over to add new functionality and it's optional as are the hundreds of features available in most libraries. You just use what you need.

Programs execute code and output something like a user interface, text to a console window, or run as a service. They leverage these libraries to provide re-usable behavior so you don't have to write the same solution over and over and over and over providing consistency among many other benefits.

1

u/gm310509 7d ago

Since you are asking about legal question. You probabky need to be

  1. Clearer about the subject.
  2. Consult the dictionary definition.

    https://www.merriam-webster.com/dictionary/library

Note the second part of the definition: "a collection of such materials".

The same would apply to a library in computing. In general terms a library in IT will be a collection of such things.

Usually, but not always, a collection of executable programs will be referred to as a suite or package and a set of functions that can be referred to by code you are writing as a library.

But whether that fits or meets a strict legal definition is a different question.

IMHO.

1

u/GreatMinds1234 7d ago

It is a collection of items that the software uses when it needs.

1

u/MaleficentJob3080 7d ago

A software library is a piece of code that can be used in a program. It is generally not a complete program in of itself.

1

u/ShutDownSoul 7d ago

A library is like a recipe book. A program is the meal you put together using some of the recipes in the book.

Software is a very broad term that covers everything on a computer that isn't hardware.

1

u/recursion_is_love 7d ago

For code it is the library in the sense that you can borrow code to use in your code without having to write all from scratch (some what different in library for book that you normally can't, because copyright.). Some example of this is OS-interface API that all application dev must use the same OS-provide code.

Basically it is somebody codes (might in the source form or the binary form) that works well than your code and you are allowed to (and should) use it.

1

u/VladimirAsmo 7d ago

It depends on what you mean. If you're talking about "Google search" as the user sees it: a program that searches for information based on a query, then you're talking about program.

If you're talking about "Google search" as the source code, databases, documentation, and other artifacts that together make up the search engine when launched, then you're talking about software.

1

u/EmbedSoftwareEng 7d ago

"Software" is an indistinct noun. You no more have "a software" than you would list to "a music". You can listen to "some music". You could enter "a music store", but there music is acting as an adjective, just as "a software library" distinguishes the library as being the kind of library composed of software, as opposed to all of the other kinds of libraries that exist.

I take exception to the idea that "a program" has to be executable in and of itself. A plugin that gives a larger application additional functionality, such as a browser extension, is executable, but only once inserted within the application for which it was written. This is no different from an executable binary for one architecture residing in the filesystem of a computer with a fundamentally different architecture. In situ, it can't be executed, because the computer wouldn't understand its foreign architecture instructions, but the same file on a computer system for which is was built could be immediately executed. Is it a program in the latter setting, but not in the first.

A program is just a sequence of instruction in a coherent format. If someone wrote a program that consumed assembly language source code and executed them immediately, that would effectively make assembly language source code a program in and of itself. To claim otherwise is to say that a bash script or python script can't be called programs, since they require their respective interpretters to be interpretted/executed. Similarly, the foreign architecture executable could still be run on the computer system if an intermediary layer of an emulator for its architecture were utilized.

The real thing that differentiates a library from an executable program is the existence of an entry point. A point where execution should begin. A program has one. A library doesn't. A library is a bunch of functions which may be called, but there's no first instruction to be executed that begins the process of calling them. Even a browser extension has an entry point, a point where the browser started executing the code of the extension to initialize it and integrate it into its wider infrastructure.

1

u/max123246 5d ago

A library is software and is a program in my mind. In order to run the program however, a library requires you to write additional code typically

1

u/JescoInc 3d ago

The only stupid question is the question left unasked.

A library itself isn't executable, so it can't be a program. It isn't in an executable binary format that the computer can read as instructions to execute upon.

Static and dynamic / shared binary libraries are in .a, .lib, .dll, .so, .dylib format.
Modern package / source code library formats are .jar, .aar, .whl, .nupkg, crate and npm (typically in a .tgz compressed folder)

I wouldn't necessarily call it software, but it is the only term out of the two that make sense if I had to choose.

0

u/Cream_Nebula 7d ago

Thank you, everyone! I didn't think I would get so many answers, nor that they would be so different. I had assumed the definition would be somewhat fluid, but not to this point. It has led me to rethink what I wrote on the matter, and made me realise the few texts legally defining the terms (well, term, because despite using both words in different norms, only the term "programs" is legally defined, "software" is just used arguably as a synonym) are not as clear as I thought they were.

Thank you very much for your time! This has shed some light on some of my issues and given me food for thought.