On 7/24/02 6:20 AM, "Dossy" <dossy / panoptic.com> wrote:

> On 2002.07.24, Benjamin Peterson <bjsp123 / yahoo.com> wrote:
>> Are there people out there who really do this?  Build
>> GUI apps by first writing a non-GUI application, and
>> only then start to think about what sort of GUI
>> framework can be bolted on to it?
> 
> Yes.  There's a reason the Model-View-Controller (MVC)
> pattern is so well-known.
> 
> Implement a simple non-graphical UI as your View, then
> replace it later once you have the "meaty bits" like
> the Model and Controller fleshed out.
> 
> This works well enough that you can have a seperate
> team doing the Model and Controller bits from the
> team who is building the View bits.

Dossy is absolutely right here. I would add that if you are building a
program with mutiple interfaces, say a GUI and a scripting/recording
interface for AppleScript/VBA or a GUI and a CORBA interface, you *have to*
use this pattern.

But Benjamin talked about "you may be able to write your core functionality
in a very linear way" and, if I understand him, this is something that one
must avoid. The Model itself can't make any assumptions about the order of
messages that it will receive other than that it will get some kind of
initialize message first and some kind of finalize message last. It can
never initialize communication with a user but must rather passively wait
for messages. If it is written this way, one can indeed "bolt on" sereral
Uis.
-- 
There is, nevertheless, a certain respect and a general duty of humanity
that ties us, not only to beasts that have life and sense, but even to
trees and plants. -Michel de Montaigne, essayist (1533-1592)