0

I have a created a Java project. My project is a collection of classes that allow a programmer to manage local networks (create network, delete network-access to device, get information of SSID) and other functions in the local network. The architecture of program is based on CMD commands. All classes are reusable by programmer. I will export my project as a JAR for use in other projects.

Now I'm confused between two terms for my project: Should I call it an API or a library, or are there other terms for this type of project?

Whenever I ask people about the difference between an API and a library, I get different opinions. Some will tell you that an API is a bunch of mapped out functions, and a library is just the distribution in compiled form.

Is there really a clear difference between APIs, frameworks, and libraries?

closed as primarily opinion-based by Jörg W Mittag, gnat, BobDalgleish, Robert Harvey, 8bittree Dec 19 '17 at 22:13

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    If it's like a plugin architecture where your developers write plugins for your product, then your application would be an executable loading their libraries and calling into them. If it's like a library to be used for developers writing their own applications, then they'd call functions into it. Both cases would provide an API to interact with the functionality you provide. – user204677 Dec 17 '17 at 23:47
  • 1
    The distinction of frameworks and libraries is a bit more fuzzy, but often the "framework" will rely more on abstractions and IoC, while a library might consist of more concrete types to just use directly. That's just kind of my take on it given the trends. This area is a bit fuzzy. – user204677 Dec 17 '17 at 23:51
  • 2
    rather blatant duplicate of Library vs. framework vs API? – gnat Dec 19 '17 at 17:02
  • 3
    Possible duplicate of Library vs. framework vs API? That said, the accepted answer could be better. – Robert Harvey Dec 19 '17 at 17:09
  • Sometimes, the difference between library and framework is, your code calls library routines, but framework routines call your code. That is to say, if you're dealing with a "framework", then you are likely to end up writing a lot of handlers. – Solomon Slow Dec 19 '17 at 17:29
6

Often APIs and a libraries have a 1:1 relationship, so I can understand some of the confusion. Often, a library to solve some problem has its specific way how to interact with the library (making up the API).

An API (Application Programming Interface) is the way your application communicates with some software component, typically a library. A typical example is the Java API. It defines lots of classes and methods that can be used by your application.

A library is a collection of functionality not making up an application of its own, but offered to application software to ease implementing some tasks. The way of interacting with that library is defined by some API. You can think of the jar files inside your JRE as being libraries (although that term isn't often used in that context) that follow the Java API. There can be different implementations (from different vendors) making up different libraries, all following the same API.

A framework not only offers some classes and methods, but also proposes a specific way how to structure your application software. The distinction between API and framework isn't 100 percent sharp, as every API influences the way you write your application. We talk about a "framework" if that influence is significant.

So, for example I'd call Java's Reflection an API (if you use it, it's typically quite local), and Java's Swing GUI a framework (using it typically has quite an impact on larger aspects of your code).

  • Can you also comment on what is an SDK? – Juzer Ali Dec 19 '17 at 13:27
  • 2
    An SDK is a Software Development Kit, typically not only containing a library with an API, but also the tools like compiler and runtime system that enables you to create applications. E.g. when comparing JRE and JDK, only the JDK qualifies as an SDK, as the JRE doesn't have the "javac" compiler necessary to create runnable classes from Java source code text files. – Ralf Kleberhoff Dec 19 '17 at 13:36
5

A Library is a collection of reusable classes and/or functions.

A framework is a reusable software environment that provides functionality as part of a larger software platform.

Libraries and frameworks both have an API. The API is the surface area of any library or framework with which your software interacts; it is comprised of all of the definitions of the publicly-declared classes, methods and properties.

References
Library
Framework
Application Programming Interface (API)

  • Re, "Libraries...have an API." OK, but that leaves a lot unsaid because, besides implementing its own implicit, ad-hoc API, a library also could implement some API that is formally specified elsewhere, or it could implement several different formal APIs. Conversely, one formally specified API might be implemented by various different libraries. – Solomon Slow Dec 19 '17 at 17:27
  • I'm not sure how all of that is relevant to the question, which merely asks for word definitions. – Robert Harvey Dec 19 '17 at 18:16
1

Some will tell you that an API is a bunch of mapped out functions

An API is how you interact, or "interface", with other applications. The API is the functions you call to do that interaction. A library is your collection of functions that help you call the interface functions.

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