The most used Design Patterns with a CI project? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1) +--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3) +--- Thread: The most used Design Patterns with a CI project? (/showthread.php?tid=74175) |
The most used Design Patterns with a CI project? - fmertins - 08-12-2019 Hello everyone, I wonder what are the most used OO Design Patterns you guys use along with your CI projects? I'm asking this because sometimes I kind of end up writing heavy controllers with a lot of complex logic and some protected methods, for example, when I have to reuse a block of code, or creating methods on MY_Controller when there is more than one controller using that logic, etc. Another example, sometimes I worry about data/variables relying on the session library because I think it's up to us to avoid overwriting a variable, so we have to be careful depending on how many variables you are going to deal in your session. Usually, my approach is using a name convention to avoid this scenario. I also like to write my own "domain classes", to avoid only "array organized data", these will be my objects that will represent my database tables (entities). I try to design them with some OO principles that we don't have in the relational paradigm, for instance, if I have a "one to many" relationship in the database, in the equivalent object I'll have a collection (array of child-objects). In other words, how many other classes, and how much complex, you guys like to create besides the traditional MVC pattern? Thanks, have a great week! RE: The most used Design Patterns with a CI project? - InsiteFX - 08-17-2019 Probably the factory and adapter patterns CI 4 is using a lot more of then. |