![]() |
Starting with CodeIgniter setup: suggestions & best practices - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Starting with CodeIgniter setup: suggestions & best practices (/showthread.php?tid=21388) |
Starting with CodeIgniter setup: suggestions & best practices - El Forum - 01-16-2010 [eluser]Watermark Studios[/eluser] Great learning path...and so true...RT(F)M! Starting with CodeIgniter setup: suggestions & best practices - El Forum - 01-17-2010 [eluser]alejandronanez[/eluser] That's a really good POST! Damn I LOVE IT! Great Job Buddy! Starting with CodeIgniter setup: suggestions & best practices - El Forum - 01-18-2010 [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 Starting with CodeIgniter setup: suggestions & best practices - El Forum - 01-20-2010 [eluser]jovaniwayne[/eluser] Thanks for this post. Very straight forward. Starting with CodeIgniter setup: suggestions & best practices - El Forum - 01-24-2010 [eluser]Unknown[/eluser] Useful post I like this. thanks Starting with CodeIgniter setup: suggestions & best practices - El Forum - 02-04-2010 [eluser]designfellow[/eluser] Nice post.. Thanks ![]() Starting with CodeIgniter setup: suggestions & best practices - El Forum - 02-04-2010 [eluser]cahva[/eluser] @Buso I know that those are your PERSONAL best practises but using camelCase is against the official CI style guide which prefers multiple words separated by underscore. Its a matter of taste really, but IMO separation with underscore is more clear to me. Everything else looks good to me so thats the only one ![]() The style guide is very good and I'll try to stick with it in all my PHP coding, not just CI. I think it has made my code more readable by others. Oh yeah and Jelmer, good job! ![]() Starting with CodeIgniter setup: suggestions & best practices - El Forum - 02-04-2010 [eluser]Jelmer[/eluser] Thanks for all the compliments. I changed the bit about Auth libraries a bit last week as the link it refers to has gotten a bit old. I'll add something about ORM's this weekend as that's something people ask about often as well. @Buso, While I would agree with many of your points, I tried to write this without anything (or at least very little) that could be considered a personal opinion rather than a best practice. That being said, I might put something in there on your points of making things as general use as possible (DRY), on using consistant naming (although I won't put a preference on either camilcase or underscores) and on using the language and config libraries. Starting with CodeIgniter setup: suggestions & best practices - El Forum - 02-04-2010 [eluser]jedd[/eluser] [quote author="Jamie Rumbelow" date="1263669444"]This is really helpful - thanks for posting it! I'm making it sticky so more people will hopefully read it ![]() It's an interesting read, verily, but sticky threads really annoy the living cranola out of me - they are a bad answer to a problem that has a better solution. Plus they tend to end up being full of pointless and irrelevant messages. Viz $this. If there wasn't a wiki available for long-term storage of knowledge, sticky threads might make a bit more sense. But if every useful thread were to be stickied, you'd end up with several dozen pages in each forum's thread-list before you got to a thread with any kind of currency. Plus people seem to be unwilling to search using a button labelled 'search', or look in the FAQ / wiki - so it's a tough sell suggesting that people will read through sticky threads before posting. Just my 2c worth. Starting with CodeIgniter setup: suggestions & best practices - El Forum - 02-05-2010 [eluser]physicsdave[/eluser] Lists like this are extremely valuable. If they didn't exist it would take a lot longer to acquire the info from random forum posts, stumbling around on Wikipedia, etc. As someone who discovered all of the information by stumbling randomly around online, I am grateful to see lists like this posted. Great starting point & awesome info! Thanks! |