On 11/23/05, Beorn <[EMAIL PROTECTED]> wrote:
>
> I don't think scaffolding is bad just because it can't support all
> admin interface situations.  It's great while you're prototyping, and
> may be perfectly fine for many applications where you just want a
> simple admin interface.  Django's admin interface falls down as well if
> your requirements are a bit complex.  It's the same argument.

Not really; not only does scaffolding not "support all admin interface
situations", it doesn't even support a significant fraction of them.
The vast majority of applications will throw out the scaffolding and
implement their own preferred interface, which means that it serves
very little purpose aside from the "wow factor" of having something up
and running after typing just one command. Even in the Rails book, the
scaffolding isn't kept around for prototoyping; it's used to
demonstrate how quickly you can get up and running, and then it's
promptly discarded in favor of custom-developed templates.

Django's admin, on the other hand, *does* support a significant
fraction of admin interface situations.

> As for best practices, I think we can copy and improve on RoR.  The
> directories RoR creates is a good list of "best practices" to start
> from.

I think the directories Rails creates might represent best practices
for Rails use, but I'm not at all certain that they represent best
practices for anything other than Rails.

> In Django, as soon as you have a production system with legacy data,
> you'll have to keep both the database model and the Django model
> up-to-date.  Having the framework automatically update the database
> schema is probably too volatile, so you'll have to do it manually.  The
> point is you'll ALWAYS have to deal with the database schema,
> eventually, so why not make this be the source of the model?  That is
> DRY in my opinion.

Model changes on a production site *ought* to be hard, IMHO, to ensure
that they're not undertaken on a whim. But that said, even if we throw
out the DRY argument (and I'm not convinced by this counterargument)
there's still the other factor: inferring models from databases means
that models, and therefore applications, lose a significant portion of
their easy portability, for little to no significant gain.

Also, consider this: your original argument was that inferring models
from the database is useful because then you can "get an admin
interface up-and-running just by pointing to a database". But
regardless of whather the model is specified in Python or inferred
from the database, at some point it has to be specified -- for that
database to exist and have the tables it does, someone must have
written and executed some SQL. Now, probably the overwhelming majority
of new developers adopting Django are not going to be integrating with
legacy databases, and in any case they wouldn't do it by pointing at
their production DB. So one way or another, the first step is *always*
going to be specifying the model. What usability gain, then, is there
in making this specification vary depending on the inconsistencies and
idiosyncracies of different database systems, when right now we have a
perfectly good way of specifying models which has one and only one
syntax that a developer must learn?

> Django isn't strictly MVC...  Well, maybe it's close enough, and maybe
> it should be made more close.  In any case, redefining well-established
> names like 'view' (especially when there is a 'model' in there as well)
> is not going to make it any easier to understand.

Django shouldn't be strictly MVC unless being strictly MVC is the most
effective way for Django to do what it does. Perhaps we can start
calling it a "model-view-template" framework and avoid the whole mess.

> I'm not saying Django should be 100% like RoR, but I'm just afraid
> we're so stuck on trying to be different that we're falling victim to
> the "not invented here" syndrome and ignore good learnings from RoR.

I don't think anyone is stuck on "being different" from Rails. Django
should try to do things the best way it can, no more, no less.

--
"May the forces of evil become confused on the way to your house."
  -- George Carlin

Reply via email to