On Mon, Mar 16, 2009 at 6:34 PM, Ryan Angilly <ang...@gmail.com>
This one begins with a comment of "I don't really understand why people use namespaced models." That's not really a compelling argument.
There is a reason we namespace things in general. Otherwise, why have these top-level modules like ActiveRecord in the first place?
The main argument here, other than the strictlyuntyped link, is that you can't do it in the database -- so what? You can't define methods on a database table either, yet we do it in Rails. Database tables can't be polymorphic all by themselves, but Rails adds that. And the naming convention could ensure that while it is a flat namespace of DB tables, the namespaced ones will never conflict with anything outside that namespace.
This describes bugs in the current implementation.
So, it looks like the biggest argument not to use namespaced models is that they don't work very well in Rails.
Isn't that a bit like arguing we shouldn't have started using REST, because it didn't work very well in Rails? That was seen as a bug to be fixed, or a feature to be added, not a hazard to be avoided.
The other argument that seems to be tossed around a lot is that you can put things into a subfolder. Somehow, I think that would be less useful -- now the convention of filename->class name is broken, and I can't get a list of all top-level model classes by looking in app/models. It also doesn't address the real reasons you might use namespaces.
If anyone can offer any reason namespaces shouldn't be done, other than that Rails doesn't do them well, that'd be a more interesting discussion.
Otherwise, it's circular reasoning. We shouldn't fix Rails namespacing, because namespacing is a bad idea, because Rails doesn't do namespacing well, because no one's fixed it yet.