This page or section is in question as to whether it is useful or not. You can discuss whether you think it should be deleted or not on its talk page. (August 2021) |
- This article is about the programming feature. For Scratch libraries, see Library.
A Library is a group of classes or functions that are used to program in a specific area. An application programming interface (API) is the interface to the library. Libraries are useful because they abstract away from implementation details and allow programmers to code without needing to understand the inner workings.
Block Packs
Block packs (commonly referred to as engines) are projects that contain custom blocks for the use in other projects. Function libraries are made because a user specializes in a certain area. For example, a Scratcher might make a 3D engine to allow others to easily create 3D projects.
Libraries in Other Programming Languages
C and C++
In C and C++, libraries are accessed using the #include
preprocessor directive. Conventionally, header (.h, .hpp) files contain declarations are included, but the source (.c, .cpp) files containing the corresponding definitions are not. To alleviate multiple includes, header files use include guards, the introduction of macros that are used for determining if the file has already been included.
Java
In Java, packages of classes are accessed with the import
statement.
Python
In python, packages can be downloaded through the python packages website and accessed with the import
statement. When importing, one should strip the .py
file extension and just use the name.