singular or plural on models controllers?

Like the others said, it doesn't matter.

Concerning models, I like to use singular when the class represents a single row, e.g. when using Active Record or Table Row Gateway and plural when working with classes representing tables and recordsets, simply because I could make these return or contain classes with singular names and I could distinguish between them. But then again, I could just as well name them UserTable, UserCollection and User. Use what best represents your domain.

Some frameworks have a convention for naming models and controllers to work some automagic. For instance, the singular models will be inflected to use plural tables by default, so you do not have to map it yourself. This is called convention over configuration; over, because usually you can still configure it as you see fit.

The only time when I'd say it doesn't matter how you name your models and controller is when a code convention in use.


KohanaPHP handles their singular/plural MVC components very well. I would check it out for reference as it makes sense. But when it comes down to it, it really doesn't matter and it depends on the programmer. I mean, if you are getting a bunch of lists, do get_lists() or if your getting contents of a list use get_list().


It doesn't matter.

I personally use singular for models and plural for controllers.

What matters, however, is that you pick a scheme and be consistent.


That depends on the model. If objects of that class represent exactly one thing, use singular, if they represent many things, use plural (but you usually do not need such a class, use an array/a collection). Both cannot happen or you should redesign (1).

I'll use your Thread example:

If every object models one thread, name the class "Thread". If it models several threads at once, call it "Threads" (or "ThreadCollection" or the like).

(1) If you need both, a representation of a single thread and a representation of many threads at once, use two distinct classes (Thread and Threads) or create an array or a collection for the latter. Then you'll have it clean: $thread->show(); $threads->list();