This is a question about code organisation, I think I may be encountering some ‘code bloat’ within one of my project’s controller classes. I follow the ‘fat model skinny controller’ concept; all data validation/sanitisation is done within the model, no exceptions. My problem is the size of the controller, I think it has too much functionality, #1134 lines long and 40kb in size, is this large?
Here’s the skeleton of the controller; it deals with publishing posts to a blog ‘articles’ and comments to articles, voting, updating, editing. They all call models, pretty self explantoy action names.
class Articles extends MY_Controller
{
public function __construct()
public function _remap($method, $params = array())
private function _set_category($category_title)
private function _set_article($article_title, $article_draft, $author, $article_pending)
private function _render_similar_articles($draft, $author)
public function index(){}//index page for articles
public function delete(){}//delete an article
public function delete_draft(){}//delete a draft article
private function _update($article_draft, $author){}//update a draft article
public function drafts(){}//view draft aricles
public function pending(){}//view pending draft articls
public function publish(){}//create an article
public function report()//report an article - form actions point here
public function comment(){}//comment on an article
public function delete_comment()//delete a comment from an article
public function quote()//quote a comment
public function report_comment()
public function bookmark()//bookmark an article
public function vote()//vote an article
public function comment_vote()
}How can I better structure this, ideas please?