(05-29-2015, 12:09 PM)mwhitney Wrote: (05-29-2015, 09:50 AM)Narf Wrote: I disagree ... Libraries are supposed to be portable, not dependable on the application that uses them and you don't get that when a library uses a model.
The portability of the library is not improved by accessing the database through the database library instead of a model. You would still need to specify the database structure (in a migration or documentation), and you have other problems to deal with if your library isn't the only access point for that data (and if it is the only access point for that data, what's it doing that makes it a library instead of a model?).
Who said a library has to use a database? Or that it is a data
access point at all?
You should be able to take a library, drop it in another application and work with it with no changes necessary. A model on the other hand is designed for a specific application. That's the only difference between the two.