On 12/4/2009 10:40 AM, Michael Torrie wrote:
Lie Ryan wrote:
On 12/4/2009 12:44 AM, Michael Mossey wrote:
I have a question about typical organization of GUIs. I will be using
PyQt.
Model-View-Controller (MVC) pattern.
Model - all the business logic lives in the model.
View - your GUI
Controller - Takes input
No, you've got it wrong:
Model - Your data or database, some rules to enforce integrity
Controller - your business logic
View - Your gui, takes input
perhaps you meant MVP:
"""
* The model is an interface defining the data to be displayed or
otherwise acted upon in the user interface.
* The view is an interface that displays data (the model) and routes
user commands (events) to the presenter to act upon that data.
* The presenter acts upon the model and the view. It retrieves data from
repositories (the model), persists it, and formats it for display in the
view.
"""
MVC:
"""
Model
Is the domain-specific representation of the data upon which the
application operates. Domain logic adds meaning to raw data (for
example, calculating whether today is the user's birthday, or the
totals, taxes, and shipping charges for shopping cart items). When a
model changes its state, it notifies its associated views so they can
refresh.
Many applications use a persistent storage mechanism (such as a
database) to store data. MVC does not specifically mention the data
access layer because it is understood to be underneath or encapsulated
by the model. Models are not data access objects; however, in very
simple apps that have little domain logic there is no real distinction
to be made. Also, the ActiveRecord is an accepted design pattern which
merges domain logic and data access code - a model which knows how to
persist itself.
View
Renders the model into a form suitable for interaction, typically a
user interface element. Multiple views can exist for a single model for
different purposes.
Controller
Receives input and initiates a response by making calls on model
objects.
"""
[*] all source taken from wikipedia.
--
http://mail.python.org/mailman/listinfo/python-list