Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, January 1998
General MVC Design Question.


Message 1 in thread

I am putting together a piece of educational software that is
patterned on the Model-View Controller design pattern. The backend
(Model) is complete and functional and I am finishing up the view and
I realize I don't really understand where the Controller code should
go.

Once the QApplication creator has executed, where does the program go?
Flying around the event loop waiting for things to happen. So where
can I instatiante a class, or a piece of code that everything can send
messages to to act as a controller?

This is probably way too much gobbledygook (sp?), mostly because I
really haven't deeply understood this model of programming, anybody
have any general design hints?

-- 
 [ signature omitted ] 

Message 2 in thread

Craig P Earls wrote:
> 
> I am putting together a piece of educational software that is
> patterned on the Model-View Controller design pattern. The backend
> (Model) is complete and functional and I am finishing up the view and
> I realize I don't really understand where the Controller code should
> go.
> 
> Once the QApplication creator has executed, where does the program go?
> Flying around the event loop waiting for things to happen. So where
> can I instatiante a class, or a piece of code that everything can send
> messages to to act as a controller?
> 
> This is probably way too much gobbledygook (sp?), mostly because I
> really haven't deeply understood this model of programming, anybody
> have any general design hints?
> 
> --
> ----------------------------------------------------------------------
> Craig P Earls                                      cpearls@ziplink.net
> LT US Navy, MIT Aero/Astro Engineering                 cpearls@mit.edu
> ----------------------------------------------------------------------
> 
> --
> List archive and information: http://www.troll.no/qt-interest/

Morjen,

I guess, Qt has more a View/Controller architecture. That correspondends
about to the Model/View/Controller architecture of the Smalltalk-world.
Widgets are the view classes with properties of a controller, because
they can also emit and match events. Classes like for example QPixmap
can be seen as the model classes, they contain the data of the program
and own method for loading and saving of this data. I think,
QApplication is more a controller class. While executing its exec()
method, it controls all input and output that may happen.

Remember, to start the event loop you have to call QApplication::exec()
in the main() function of your application. Before you do that, you can
initialize other objects like the mainframe widget or your own special
class instances and they can also create more objects in its constructor
method. If this classes have methods for matching the Qt-events, this
methods will be called automaticly when the application's exec() is
running and the appropriate events occurs. Exec() permanently flies
around, watches your input and activate the appropriate widgets. It's
like a controller of your program. Output is shown with the same
principle. The mechanism for that is hidden in the Qt framework und the
underlying operating system. Activities for the working on your data can
be realized by connecting the widgets member functions for event
processing with the desired actions on your data.

I hope, that may help you, because I think that problem can fill a book.

Bis denne, machs mal jut!,
			Falk Brettschneider


Message 3 in thread

Craig P Earls wrote:
> Yeah, to bad most OOP books are more about syntax than design!

Gruss,

Try to find a book especially about OO-software analysis and design.
There are a few good ones... I recommend the holy bible of Grady Booch.

Viel Spass,
	Falk

---------------------------------
Falk Brettschneider
TextilComputerDesign GmbH Dresden
Germany
---------------------------------


Message 4 in thread

On Tue, 13 Jan 1998, Gert Weigelt wrote:

> Try to find a book especially about OO-software analysis and design.
> There are a few good ones... I recommend the holy bible of Grady Booch.

Additionally I recommend "Design Patterns" from Erich Gamma and others.
I'm a fan of design patterns in generall. ;-)

cu
		Michael


      o-------------------------------------------------------o
      ! arago,                          Michael Roth          !
      ! Institut fuer komplexes         Software Engineer     !
      ! Datenmanagement GmbH            eMail: mroth@arago.de !
      ! Hahnstr. 70                                           !
      ! 60528 Frankfurt am Main         http://www.arago.de   !
      ! Tel: +49-69-66441-400           Fax: +49-69-66441-499 !
      o-------------------------------------------------------o



Message 5 in thread


> Date: Tue, 13 Jan 1998 19:01:06 +0100 (MET)
> From: Michael Roth <mroth@arago.de>
> To: Gert Weigelt <gert@tcd.tz-dd.de>
> Cc: cpearls@ziplink.net, qt-interest@troll.no
> Subject: Re: General MVC Design Question.
> 
> On Tue, 13 Jan 1998, Gert Weigelt wrote:
> 
> > Try to find a book especially about OO-software analysis and design.
> > There are a few good ones... I recommend the holy bible of Grady Booch.
> 
> Additionally I recommend "Design Patterns" from Erich Gamma and others.
> I'm a fan of design patterns in generall. ;-)

This book is well worth reading, there's also a lot of useful information on 
patterns at http://hillside.net/patterns/

Rich.

> 
> cu
> 		Michael
> 
> 
>       o-------------------------------------------------------o
>       ! arago,                          Michael Roth          !
>       ! Institut fuer komplexes         Software Engineer     !
>       ! Datenmanagement GmbH            eMail: mroth@arago.de !
>       ! Hahnstr. 70                                           !
>       ! 60528 Frankfurt am Main         http://www.arago.de   !
>       ! Tel: +49-69-66441-400           Fax: +49-69-66441-499 !
>       o-------------------------------------------------------o
> 
> -- 
> List archive and information: http://www.troll.no/qt-interest/

 _______________________________________________________________________ 
| Richard Moore                         | Email: richard@cs.man.ac.uk   |
| IT301, Computer Science dept.,        |           rich@kde.org        |
| University of Manchester, Oxford Rd., | Phone: (0161) 438 0038 (home) |
| Manchester, M13 9PL                   |        (0161) 275 6270 (work) |
| UK                                    |        (0161) 275 6280 (fax)  |
|_______________________________________|_______________________________|