If I wanted to create a blog I would probably make these two controllers.
- Post controller, for viewing blog posts
- Admin controller, for login and administrative stuff
But if you imagine viewing a page with a blog post in it it will have several objects. Firstly there is the actual post-object which holds the content of the post, and then there could be a comment object, if you have a comment section. A comment object could inherit from a people object. Maybe if the blogpost where to be a photo album, instead of the traditional text, the post object would inherit from a photoalbum object.
I see all these objects which fits into the post-section of the site, but I have no clue where to put them. Should I make them inside the controller? How would I then go about using that object another place? Or should I write them to a library, include the library and then initiate them when I need them in the controller I am working in?
What is the proper way of doing this? Since up until now I have only typed procedural code within the methods of the controllers I make.
Any input on this case would be appreciative.