CodeIgniter Forums
Refactoring:- Fat controller fat library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Refactoring:- Fat controller fat library (/showthread.php?tid=49703)



Refactoring:- Fat controller fat library - El Forum - 02-29-2012

[eluser]charlie656[/eluser]
Hi all,

Im working on a fairly large and developed codebase for an elearning platform that uses codeigniter. Each time a web page is viewed by a logged in user a lot of different functionality may be invoked, this has grown steadily over time.

I am thinking about how to approach refactoring the code.

At the moment each page view is handled by one controller function which has a fair amount of code in it before it calls a library method which also has a lot of code in it. Both make calls to models to do db queries.

I want to refactor the functionality and break it into meaningfull classes that each carry out one task.

Should I refactor into a set of libraries, a set of models or can I use plain old PHP classes.

All suggestions welcome.


Refactoring:- Fat controller fat library - El Forum - 02-29-2012

[eluser]Mauricio de Abreu Antunes[/eluser]
My refactoring code is about MY_Model and MY_Controller.