CodeIgniter Forums
Naming a model class - 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: Naming a model class (/showthread.php?tid=9357)



Naming a model class - El Forum - 06-22-2008

[eluser]mattalexx[/eluser]
In the docs, it mentions this:
Code:
class Blogmodel extends Model {}
Then it mentions this:
Code:
class User_model extends Model {}
What's the best way to name my models? Should I use the underscore or not? If the object name has more than one word, which one is it?:
Code:
class Item_Image_model extends Model {}
Code:
class Item_image_model extends Model {}
Code:
class ItemImage_model extends Model {}
Code:
class ItemImageModel extends Model {}



Naming a model class - El Forum - 06-22-2008

[eluser]EEssam[/eluser]
I was confused as well then I decided to use "User_model".


Naming a model class - El Forum - 06-22-2008

[eluser]sikkle[/eluser]
i usually keep it clear like :

User_model

Good luck !


Naming a model class - El Forum - 06-22-2008

[eluser]Colin Williams[/eluser]
Just choose the style you prefer and stick with it throughout your application. I particularly like underscores and dispise camelCase, but to each his own.


Naming a model class - El Forum - 10-30-2008

[eluser]mattalexx[/eluser]
[quote author="Colin Williams" date="1214216761"]Just choose the style you prefer and stick with it throughout your application. I particularly like underscores and dispise camelCase, but to each his own.[/quote]

This new piece of the user guide explains what I was trying to figure out:

http://ellislab.com/codeigniter/user-guide/general/styleguide.html#class_and_method_naming


Naming a model class - El Forum - 10-31-2008

[eluser]Adam Griffiths[/eluser]
[quote author="mattalexx" date="1225417325"][quote author="Colin Williams" date="1214216761"]Just choose the style you prefer and stick with it throughout your application. I particularly like underscores and dispise camelCase, but to each his own.[/quote]

This new piece of the user guide explains what I was trying to figure out:

http://ellislab.com/codeigniter/user-guide/general/styleguide.html#class_and_method_naming[/quote]

And just as I was going to say to user _ rather than camel case, because CI does it all that way, and it says so in the user guide!!