Welcome Guest, Not a member yet? Register   Sign In
What is the best way to write organize your code?
#3

[eluser]gtech[/eluser]
some more tips.

11) Models are considered to be database centric, but if you are unsure whether to put a piece of code in the controller or the model don't get to stressed over it, do what you think is right and be consistant as sometimes there is a grey area.

12) when passing a data array to a view don't forget the keys in the associative array become the variables in the view.

13) Once an associtive array has been passed to a view, the variables are available in EVERY other view in the same request, without having to pass the array to them again.

14) The XMLRPC code works quite well but I have found that you can only call functions in the same controller as the XMLRPC server.

15) A lot of databases don't support transactions within transactions.. so be carefull when calling a function with a transatcion from a model to another model function with a transaction. If this is the case put some conditional tags around the transation code to see if its being called from another model function with a transaction (phew that was a long winded tip)

16) When I have designed a datamodel, I usually keep my model classes closely linked to the table names, e.g. users.php would have add_user, edit_user and so on.. again sometimes there is a grey area as a function my need to join two tables, again I just try to use a consitant approach when this happens. Other people do have different methods.

17) Some people like to use [url="http://ellislab.com/forums/viewthread/65749/"]modular separation of code (Matchbox is a good example)[/url], its not my preference but wont hurt to get familiar with it.

18) dont spill coffee on the keyboard, my space bar is suffering.


Messages In This Thread
What is the best way to write organize your code? - by El Forum - 06-19-2009, 10:00 AM
What is the best way to write organize your code? - by El Forum - 06-19-2009, 11:31 AM
What is the best way to write organize your code? - by El Forum - 06-19-2009, 11:48 AM
What is the best way to write organize your code? - by El Forum - 06-19-2009, 11:52 AM
What is the best way to write organize your code? - by El Forum - 06-19-2009, 12:12 PM
What is the best way to write organize your code? - by El Forum - 06-19-2009, 12:24 PM
What is the best way to write organize your code? - by El Forum - 06-19-2009, 12:26 PM
What is the best way to write organize your code? - by El Forum - 06-19-2009, 03:10 PM
What is the best way to write organize your code? - by El Forum - 06-19-2009, 03:52 PM
What is the best way to write organize your code? - by El Forum - 06-19-2009, 03:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB