As my webapps increase in size, so does the complexity. In order to keep my classes & files structured and easy-to-access, I am starting to get more and more confused:I have some very clearly defined data objects in my application - orders, invoices, products for example. All of those have their own entity object that handles enforcement of values and pure business logic along with a model that handles storage of each object to my  persistent storage of choice (database).Ok - everything clear and separated that far. But what about a logic-heavy object like users?Users log in and out, change password (with everything that means - hashing, encrypting and so forth) and do a whole lot of interaction both in the database and with Sessions.Right now, I use an Authentication-class, a library, which carries all of these mentioned actions and a lot more. It does it's job, but It's kind of unclear to me what I should put into a model and what should be a Library?
Drawing the line between models & libraries?
libraries;mvc;model
I do think you kind of answered you own question - Models should simply include basic data-related logic, and every other more abstract functionality should be handled by library classes (IMO - should be taken with a grain of salt, as there are a lot of definitions of MVC and the likes for the web).So, to extend on your example: the User class, would have setUsername, getUsername, setPassword, getPassword, validate, destroy, hash, encrypt etc. While it is true that logIn can be considered a data-related function, and can be placed in the model (matter of style and taste I guess), to me it looks more specialized and I would place it in a separate class called Authentication, which takes care of all User related, not directly tied to the data functionality.To sum it up, I consider this to be largely a matter of coding style. After all, it should make sense to you as long as you develop/maintain it. And of course, it should be well-documented so in case someone inherits said code, they wouldn't get lost :)