From: Kevin <ke...@dr...> - 2006-04-30 20:31:10
|
Evan Roth wrote: ... > in any case, in regards to my 2 points above: > 1. i see that Kev began laying the foundation for this yesterday. i'm > going to simply jump in and help out there, whenever i need a > function, i'll simply add it to a class. this will eventually tone > down init.php over time. if someone has a better idea on how to > systematically chop at this let me know. in any case, i'd start in on > the options and users, since that's what i had on the table for the > next step towards multi-user. > [note: Kev, i'd recommend you rename actions/entities to > controllers/models respectively, since that is more standard > terminology] > I am by no means an expert at this sort of stuff, so I started with the easiest. I created a class for each noun in the system. Most of them conveniently map to db tables. I think of them as just simple data objects with little/no behavior of their own. It should be the job of something else to store/retrieve/alter them in the database. (maybe that's the model) I didn't want them to be weighed down with lots of methods. I pictured the actions directory as containing both the model stuff and controller stuff. Essentially everything that is in init.php right now. There will be classes for CRUD operations for persisting and retrieving the entities from the database. Then there would be other classes for higher level operations like updating feeds, tagging/marking items, performing searches, and filtering/reformatting the contents of items. Now that I think more about it, I can see where the entity persistence related operations (model) really don't belong in with the actions/controller. -Kevin |