Welcome Guest, Not a member yet? Register   Sign In
silly questions. Article_model or Model_article?
#11

[eluser]jedd[/eluser]
Sheep, pants, scissors - off the top of my head.

I have a sneaking suspicion that there may in fact by many, many more.
#12

[eluser]Dam1an[/eluser]
Ah yes... Although I (beleive it or not) have never yet felt the need to call a model/controller 'sheep', 'pants' etc lol
In most cases, such as pants, scissors, maybe even sheep, I don't think they would be very good names lol

As soon as I come up against something like this, I'll let you know how I resolve it in a real world situation
#13

[eluser]jedd[/eluser]
Okay .. here are some more 'real world' (though what is unreal about sheep escapes me - not just because I used to be a sheep farmer either).

fish - slightly more generic, and all the rage in the newspapers in the UK at the moment (notice how they can focus on only one story at a time, and never for more than 5 days?) so all those ex-NHS knobbers are off writing IT systems to deal with fish now

premises - probably going to pop up for anyone writing a housing, real estate, or trading-post style system

precis - might crop up, depending how literate your developer was

series - almost definitely going to pop up along your travels, in this context

species - something that I've already attended to in the database I'm working on right now
#14

[eluser]Michael Wales[/eluser]
I also follow the plural controller singular model method and haven't run into an issue with words that are spelled the same in both instances.

Fish: If it was a shopping cart site it would be products/product. If it was an informational site it would be articles/article. Can't see any reason why I would specifically be talking about a fish in any of my applications.

Premises: Same thing, I'm not referring to premises, I am referring to listings/listing (for instance, a real estate sale site).

The only one I think has any merit is your species example, even then I don't see why I would ever have a model so strictly defined as Species. It would probably by animals/animal and species (as well as ,kingdom, phylum, class, order, family) would be properties of that class.

The fish example is a great one - because you have to think of your program as a developer. You the developer don't give a damn about fish - you only care about products, articles, whatever that data is representing.
#15

[eluser]jedd[/eluser]
Quote:The only one I think has any merit is your species example, even then I don't see why I would ever have a model so strictly defined as Species. It would probably by animals/animal and species (as well as ,kingdom, phylum, class, order, family) would be properties of that class.

Fairy nuff.

The database I'm writing now has 21 tables of taxa - including taxa_species and taxa_subspecies, and I reference both those particular tables from two other tables (organism and synonym.) But note that my goal here is not to come up with examples and have everyone pounce on them and prove out why that one example is irrelevant to them, this week, for their application.

You're right, though -- if your experience is writing conventional commerce based applications for handling the selling of widgets over the Net, then you're not likely to bump into these cases.

Happily my point was simply that having an arbitrary and inconsistent feature of a natural language as the distinction between controllers and models will not scale, as there will inevitably be collisions at some point. Not just the problems of non-obvious plural/singular combinations (most people think 'data' is singular f.e.) but because of many other interesting English features.
#16

[eluser]Michael Wales[/eluser]
Definitely a valid point and I completely understand that you weren't tossing examples out in a "what about this?" scenario.
#17

[eluser]tonanbarbarian[/eluser]
[quote author="jedd" date="1246379516"]What do you do with words that are both plural and singular? Do you avoid using such words or just wear the inconsistency?[/quote]

I fudge things a little bit.
I either misspell one of them
i.e. sheep
controller: sheeps
model: sheep
or maybe i would use
controller: sheep
model: lamb

Pants
controller: pants
model: pant

scissors
controller: scissors
model: scissor

to make things more confusing i not only name my controllers plural and my models singular, but if there is a table that maps to the model is it plural, because it contains many records.

so controller: staffs, model: staff, table: staffs
just my way of doing things that makes sense to me (when used with a normal example)

The one real world example I have is staff
In this case I made the following
controller: staffs
model: staff




Theme © iAndrew 2016 - Forum software by © MyBB