Skip to main content

Posts

Showing posts from 2013

Bad Cakephp habbits

Bad CakePHP Habits & How to Rectify Them! SUNDAY OCTOBER 27, 08:23 I've been thinking a lot recently about how I can best help the CakePHP community - to try to give back some of the love which I have received over the years. I have been fortunate to use CakePHP for over 5 years now, and in that time have gotten to know some key members of the CakePHP community. So, what I wanted to go over was a few bad practices which I have seen over the years and how the correct procedure should be implemented.  This isn't to say my code is perfect, but as a programmer we are always learning, so it is important to follow the best practices and adjust to them as you learn them! CAKEPHP CONVENTIONS There are actually CakePHP coding conventions which should be followed.  These can be  viewed here .  I will highlight a few things which I often notice when viewing other programmers code. 1) Control Structures.  So often you see programmers get this wrong, and in even some cas

Why implement Fat Model and Skinny Controller in CakePHP

Fat Model and Skinny Controller  encourages developers to include as much business logic into the application models and the controllers should translate the requests, instantiating classes, getting data from the domain objects and passing it to the view. This development methodology is not new but rarely adopted among the developers. Developers should focus on creating model behaviors rather than creating controller components. It is a simple and powerful concept to implement is offers numerous convenient features to the developers. Controller is responsible for handling & executing the actions routed through the router, it should be lightweight and agile in nature. It is not about counting the lines in controller, rather putting codes in the right place. Why Fat Model and Skinny Controller: After developing for a while, when you look back at your code you’ll realize how hard it is to keep track of all these things. When you have a  Fat Controller , it can get pr