1

In a library with many code, some of them being the API which user would use to interact with the library, what should I call the rest of the code which is not part of the API directly?

In other words, what's the opposite of API called? Internal code? Private code?

Seems really simple but can't find the correct terminology!

4

An API (Application Programming Interface) is (according to wikipedia)

[...] a set of routine definitions, protocols, and tools for building software and applications.

An API expresses a software component in terms of its operations, inputs, outputs, and underlying types, defining functionalities that are independent of their respective implementations, which allows definitions and implementations to vary without compromising the interface.

In particular, an API is a convention or a set of definitions, so it is not source code. In other words, an API is mostly a social contract between developers (implementors of some library vs users of that library) documented in some report.

Hence, it makes no sense to speak of source code belonging to (or being in) an API.

Of course, an API is implemented by some source code. In practice, I would expect all the source code of a library implementing an API to be relevant (except perhaps some internal artifact, like specialized code generators used to build the library, or some test suite code).

Some APIs have several ("equivalent") libraries implementing them. A typical example is the POSIX C Standard library (on a Linux system): most Linux systems are using the GNU libc, but some are using the musl-libc, and both GNU libc and musl-libc are implementing the same API (perhaps with extensions peculiar to each library), and you could have a Linux system with both. Likewise, the (large) C++11 standard library has several implementations (most C++11 compilers give there own C++11 standard library).

(so my opinion is that you are confused)

PS. In practice, things are not always that nice. See Joel's Law of Leaky Abstraction and read The Mythical Man-Month

  • 2
    True, the more I thought about it the more I was convinced that the question doesn't make sense! The actual code (source code) is not part of the API but it's exposed to the client through the API. – Ramtin Soltani Jul 6 '16 at 6:55
3

The most common term, based on my experience, is internals. E.g. You will often hear C# guys speak about the ".NET internals". Similarly, a Win32 programmer might refer to "Windows internals". Though I've never heard this one, in the Linux world I would find it most amusing to hear someone say "kernel internals".

Example book titles from Amazon:

0

You might be thinking of a pattern where a service exposes an API via a set of service endpoints. A common implementation, for instance, is for a sey of classes to implement REST endpoints as an API, with those classes having little business logic, instead doing validation and translations, then passing the call to an internal component, unexposed, to perform the actual operation.

In this case, some names which might make sense are facade for that API layer. You might have several facades (REST, SOAP, COM) all wrapping a core implementation, which might be called the service implementation or business logic classes.

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