The difference is semantic.
A class is an implementation of a certain part of the functionality (usually fully encapsulating the functionality.
A library is a collection of units of functionality (or just one) that add functionality. Notice, I tried to stay away from the word class in this definition. Libraries can be procedural, functional, or OOP. This does not detract from the fact that this is a library. Classes just help abstraction when working with OOP.
A Framework is a library that provides a choice of architecture for writing code.
Thus, each structure is a library. Not every library is the foundation. CodeIgniter itself can be used as a structure or library. The difference is that if you let libraries guide your architecture, you use the framework. If you are not using a bit of architecture, this is a library.
This is definitely a pedantic difference, but significant. As a gross simplification, if you make a formal architecture and understand why everything overlaps the way it is specifically for your application, you use it as a library. If instead you build it that way, because, as CI does, it uses a framework. Both have significant advantages, but it’s worth understanding the difference.
ircmaxell
source share