[Tutor] class design

Kent Johnson kent37 at tds.net
Sat Jun 6 15:24:08 CEST 2009


On Sat, Jun 6, 2009 at 8:26 AM, Norman Khine<norman at khine.net> wrote:

>> You probably don't want the view code in the same class with the data.
>> It's generally a good idea to separate the model - the representation
>> of data - from the view - the display of the data.
>
> In iTools, each class has a view, edit, state etc... functions
> depending on the class.

Can you point to an example in the itools docs? I don't see this
usage. There are a some of disadvantages to this design.
- it ties the data model to a specific view technology, whether text,
Tkinter, HTML, or whatever
- it makes it more difficult to have multiple views, for example
summary and detail views, or admin edit vs user edit

I only couple a model class to a representation of the model when they
are very tightly linked, for example in serialization. User views
should be decoupled from the model.

Kent


More information about the Tutor mailing list