Welcome Guest, Not a member yet? Register   Sign In
Controller code.. your opinion?
#4

[eluser]xwero[/eluser]
The first way makes you write code that is spread out more which makes it easier to eyes.
The second way you can look for code that is similar in the different actions and you can make it DRY.

I use the second way and put the code in the cases up to ten lines per case, if it's more i use methods so it's a third way Smile
Code:
function user($action)
{
   switch($action)
   {
      case 'add': break;
      case 'edit': $this->_edit(); break;
      case 'delete': break;
   }
}

function _edit()
{

}


Messages In This Thread
Controller code.. your opinion? - by El Forum - 10-16-2008, 09:31 AM
Controller code.. your opinion? - by El Forum - 10-16-2008, 09:39 AM
Controller code.. your opinion? - by El Forum - 10-16-2008, 11:39 AM
Controller code.. your opinion? - by El Forum - 10-16-2008, 12:03 PM
Controller code.. your opinion? - by El Forum - 10-16-2008, 02:54 PM
Controller code.. your opinion? - by El Forum - 10-16-2008, 10:15 PM
Controller code.. your opinion? - by El Forum - 10-17-2008, 10:29 AM
Controller code.. your opinion? - by El Forum - 10-17-2008, 03:43 PM
Controller code.. your opinion? - by El Forum - 10-17-2008, 04:24 PM
Controller code.. your opinion? - by El Forum - 10-17-2008, 04:40 PM
Controller code.. your opinion? - by El Forum - 10-17-2008, 04:43 PM
Controller code.. your opinion? - by El Forum - 10-17-2008, 05:50 PM
Controller code.. your opinion? - by El Forum - 10-21-2008, 01:50 AM
Controller code.. your opinion? - by El Forum - 10-21-2008, 03:26 AM
Controller code.. your opinion? - by El Forum - 10-21-2008, 07:42 AM
Controller code.. your opinion? - by El Forum - 10-21-2008, 08:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB