On Wed, Jan 4, 2012 at 8:20 AM, Andre Terra <andrete...@gmail.com> wrote:
> No, you don't need to go reading about what MVC means. Django is a MTV
> framework, not MVC. There are similarities, but the differences are enough
> to confuse your head if this is your first time with either one.

I agree, i'd even say forget about MVC!

this is a pet peeve of mine, MVC was originally defined as a _modular_
design for OOP GUI frameworks.  There, for every complex user
interaction, you define three modules (usually a class each, but not
necessarily): the Model that keeps the immediate data in an
OOP-friendly way, the View that presents it using a GUI, and the
Controller, that receives events and modifies the data in the Model,
and (sometimes) tells the View to update or change modes.

Code reuse gets enhanced, since you frequently can use the same view
for different parts of the program, and the same model might be
presented in different ways by different views.  configurability also
becomes a desirable trait, that lets use the same view or model code
for different objects, just by creating differently-configured
instances.

many years later, when the 'three-tier' web architecture (storage
layer, business intelligence layer and presentation layer) was
well-known and viewed by some as overly complex for 'dynamic' web
apps, the MVC acronym got reused, but now it's a _layered_
architecture for web apps: there you design a model layer (that
presents storage with a nice API), a View layer (comprising of some
data-gathering logic and templates to generate HTML) and a Controller
layer that...... is anything else needed? well, lets say it handles
URLs.

As you can see, web MVC is totally different from GUI MVC, and it's a
very ill-fitting description, since it's about layers and not modules,
and the controller is so loosely defined (especially when compared to
the crisp definitions in GUI MVC) that every framework defines it
differently and in many cases add unnecessary complexity instead of
removing it (some PHP frameworks are particularly guilty of this).


the MTV architecture in Django is far cleaner, since it acknowledges
that there's no controller (the URL handling part is too simple to be
a layer), and makes very explicit the separation between
data-gathering (view functions/classes) and presentation (templates)

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to