• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Starting with CodeIgniter setup: suggestions & best practices

#13
[eluser]Buso[/eluser]
Thanks a lot

My personal best practices (you can take em or leave em =P):
_Write everything in camelCase when possible
_Always set up a main controller in the libraries directory, from which all your other controllers extends.
_Everything that can be output, make it a view. Eg: error messages.
_JS files in /js. Call them through a view.
_Always follow the same naming pattern, like getComments, getSomething. Wrong: findComments, fetchSomething, giveMeTheStuff.
_I can say the same about database tables and columns. If the primary key is the table's id, name it just id. If it has-a-thing, make a column named thingId, or thing_id. But stick to the one you choose.
_Try to make your methods for general purpose reusable when possible.
_Never hardcode. Make a custom config file and use it (it's clear in the userguide)
_Avoid using include/require. Only use it to add functionality to your codeigniter, but do it inside a library.

If something else comes to my mind ill write it later


Messages In This Thread
Starting with CodeIgniter setup: suggestions & best practices - by El Forum - 01-18-2010, 04:05 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.