what's a model?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

what's a model?

Aidan Gauland
Hello,

  I've been poking around on the web for information on how to build GUIs
using Morphic's widget-like morphs, and I've found some helpful stuff, but a
term that I see used a lot in this context is "model", which I still can't
figure out.

So my question is: "What's a model in Squeak?  How do I use them with Morphs?"

Thanks,
Aidan
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: what's a model?

Tim Johnson
Aidan,

A "model" is the logic of your program.  Generally, it is the abstract concept that your UI
attempts to present to the user.  For example, if you are creating a personal finance
program, your model might consist of objects like BankAccount and Transaction, whereas
your UI might consist of BankAccountView and TransactionView.

"Model" is one third of the time-tested concept of Model-View-Controller, which is a
"pattern" for creating programs with user interfaces.  If you search for MVC on the web, you
should find some pretty useful information.  Generally the theory behind MVC is that your
application's logic (or model) should be separate from its interface / presentation (view).  The
controller would be some "glue" which mediates between the model and the view, but often
the controller is sort of melded into the view these days.

Squeak does include a class called Model, which is abstract and not much used these days.  
Best not be distracted by it.

Hope that helps!  Have you looked at some of the great Morphic tutorials on the web?  I
found the chapter in Squeak By Example very informative.

- TimJ

----- Original Message -----
From: Aidan Gauland <[hidden email]>
Date: Wednesday, December 10, 2008 9:55 pm
Subject: [Newbies] what's a model?
To: [hidden email]

> Hello,
>
>  I've been poking around on the web for information on how to
> build GUIs
> using Morphic's widget-like morphs, and I've found some helpful
> stuff, but a
> term that I see used a lot in this context is "model", which I
> still can't
> figure out.
>
> So my question is: "What's a model in Squeak?  How do I use them
> with Morphs?"
>
> Thanks,
> Aidan
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: what's a model?

Aidan Gauland
Oh yes, I've read Squeak By Example and played around with Morphic a bit
(although haven't created anything useful with it), I just need to figure out
how to write a class that I can use as a "model" with Morphs such as
PluggableListMorph.

[hidden email] wrote:

> Aidan,
>
> A "model" is the logic of your program.  Generally, it is the abstract concept that your UI
> attempts to present to the user.  For example, if you are creating a personal finance
> program, your model might consist of objects like BankAccount and Transaction, whereas
> your UI might consist of BankAccountView and TransactionView.
>
> "Model" is one third of the time-tested concept of Model-View-Controller, which is a
> "pattern" for creating programs with user interfaces.  If you search for MVC on the web, you
> should find some pretty useful information.  Generally the theory behind MVC is that your
> application's logic (or model) should be separate from its interface / presentation (view).  The
> controller would be some "glue" which mediates between the model and the view, but often
> the controller is sort of melded into the view these days.
>
> Squeak does include a class called Model, which is abstract and not much used these days.  
> Best not be distracted by it.
>
> Hope that helps!  Have you looked at some of the great Morphic tutorials on the web?  I
> found the chapter in Squeak By Example very informative.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: what's a model?

Herbert König
Hello Aidan,

AG> Oh yes, I've read Squeak By Example and played around with Morphic a bit
AG> (although haven't created anything useful with it), I just need to figure out
AG> how to write a class that I can use as a "model" with Morphs such as
AG> PluggableListMorph.

any class that implements the necessary messages (e.g. #list) and
returns the expected values will do.


>> Squeak does include a class called Model, which is abstract and not much used these days.
>> Best not be distracted by it.

Together with MVC comes the dependency mechanism. This gives a model a
chance to tell all views they need to update without explicit
knowledge how many and if there are views.

This is implemented in Object and is a bit refined in Model.

Dependency is a bit non obvious and today events seem to be a
preferred replacement. But IIRC all the Pluggabble...Morphs stand as
Morphic replacements for the traditional MVC classes and thus use
dependency.

Practical consequence: If a PluggableListMorph watches an instance of
YourModelClass this instance has to send itself #changed or #changed:
to notify the PluggableListMorph to update itself.


Cheers,

Herbert  

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners