Why is it called Model ?

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

Why is it called Model ?

Panu Viljamaa-5
The MVC pattern has three principal 'actors' after
which it is named:  "Model, View, and Controller".
A variation of MVC is  "Model-View-Presenter",
as promoted in the Dolphin Smalltalk.

I recently had the thought: "Why is the 'Model' called
'Model' in these patterns? What is a 'model'?"

I discovered two quite different interpretations:

'Model' can mean a "model of the problem domain",
which our program 'models' with its classes.

Here the View is simply a 'window' or 'viewpoint'
into that model, that shows it from a specific
perspective. (This is what I always used to think
'model'  refers to). In this interpretation  the
model is something we built, in order to represent
something that exists in the 'real world'.

But 'model' can also mean something like a 'fashion model',
being photographed for a magazine, or a vase the painter
is using as a 'model' for his painting. The model in
this case is a "Real thing" (a person for instance). And
here the term 'Presenter' fits nicely; we are for instance
presenting someone in our magazine by taking their picture.

In the first case the model (as in 'prototype') is already
a presentation/representation of something. In the second
something that exists as such (perhaps a mathematical formula),
is being captured in a 'presentation' created by the presenter.

What is your idea of the meaning of the word 'model' as used
in MVC and MVP, and with software in general? Does it  matter
which way we think about it?

-Panu Viljamaa
--
http://members.fcc.net/panu/SmalltalkTypes.htm


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Peter Harrison
Panu Viljamaa wrote:


> I recently had the thought: "Why is the 'Model' called
> 'Model' in these patterns? What is a 'model'?"

The term 'model' simply means the abstraction of reality. This comes from
science, where a model is something that does not represent reality in all
its complexity, but does represent a sufficient level of detail to be able
to predict or explain a behaviour.

In programming terms the model of a business process must be able to
capture the bahavior of the real system (never mind that the computer
system often becomes 'reality').

For example, in reality you can write invoices, file them, and eventually
destroy them. There are certain rules about that, and a model of the system
must incorporate those behaviours - adding an invoice, filing it for later
reference, and destroying it. The model includes a definition of what an
invoice is.

It does not include what the view of an invoice should look like, or how a
user should enter the data for a invoice. The model is an abstraction of
reality.


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Graham Perkins-2
In reply to this post by Panu Viljamaa-5
> [ re: MVC/MVP ]
> I recently had the thought: "Why is the 'Model' called
> 'Model' in these patterns?

Just lie down in a dark room until such questions
leave your head.  They'll only cause trouble!

> What is a 'model'?"

I don't think you realise it, but this is a completely
different question.  A 'model' is any object that conforms
to the behaviour defined for the 'model' part of those
patterns you mention.

> 'Model' can mean a "model of the problem domain",
> which our program 'models' with its classes.

It could be, so long as it conforms to the behaviour
defined for the 'model' part of MVC/MVP.

> In this interpretation  the
> model is something we built, in order to represent
> something that exists in the 'real world'.

Depends what you mean by "exists" and "real world".
Many of the things in yer average domain model are
pure information artefacts.  Have you ever actually
seen a bank account?  Originally it was an abstraction
in a Venetian ledger book representing gold coins in
the real world.  Then it was an abstraction in a
computer of the ledger book abstraction.  But since
then it has acquired many capabilities and behaviours
that never existed in the real world or its paper
representation.

> But 'model' can also mean something like a 'fashion model',
> being photographed for a magazine, or a vase the painter
> is using as a 'model' for his painting. The model in
> this case is a "Real thing" (a person for instance). And
> here the term 'Presenter' fits nicely; we are for instance
> presenting someone in our magazine by taking their picture.

Irrelevant.  What counts is whether or not the software
object that you want to call a "model" can actually collaborate
with views/presenters/controllers in the way specified by
the pattern.

In fact, most of the "models" in MVC/MVP will actually
be adaptors.  And for collections/alternatives/menus
we often use some kind of selector model.  Both are
computing artefacts.  

-------------+ http://www.mk.dmu.ac.uk/~gperkins/


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Robert Klemme-2
In reply to this post by Panu Viljamaa-5
Panu Viljamaa schrieb:
> But 'model' can also mean something like a 'fashion model',
> being photographed for a magazine, or a vase the painter
> is using as a 'model' for his painting. The model in
> this case is a "Real thing" (a person for instance). And
> here the term 'Presenter' fits nicely; we are for instance
> presenting someone in our magazine by taking their picture.

you're kidding, are you?  fashion magazines are a totally
different domain.  it is perfectly legal for a word to have
different meanings depending on context.

i still can't believe you're serious...

regards

        robert


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Panu Viljamaa-5
Robert Klemme wrote:

> ... you're kidding, are you?

Not kidding, just being in the 'analysis / metaphor -mode'.

A model can be a 'representation' of something
that exists or that will exist.

But we can also use the reality as a model for things
we built.

And in MVC the model is a special type of component which
knows nothing about how it is being 'presented'.

It just struck me that these multiple meanings of the word
'model' are quite different. When we work with people,
they might assume one of them, but not typically all of
them, at the same time.


-Panu Viljamaa

--
http://members.fcc.net/panu/SmalltalkTypes.htm


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Panu Viljamaa-5
In reply to this post by Graham Perkins-2
Graham Perkins wrote:

> ...
> Irrelevant.  What counts is whether or not the software
> object that you want to call a "model" can actually collaborate
> with views/presenters/controllers in the way specified by
> the pattern.

My concern is that there is more to building systems
than just creating 'software objects'. There is also
the 'analysis' phase, in which the word 'model' may
pop up as well. An in the 'prototyping' phase 'model'
might in fact refer to the prototype.

So my question was both about MVC/MVP specifically,
and  also more generally about how the use of the word
'model' relates to and contrast with other uses of it,
in the domain of  systems building.

Showing an MVC architecture to someone who had never
heard the term, how would we explain the reason why
we are calling one specific object the 'model'?

-Panu Viljamaa


--
http://members.fcc.net/panu/SmalltalkTypes.htm


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

krasicki
In reply to this post by Panu Viljamaa-5
I cannot assure you that this is why <i>model</i> in MVC is called
model but one of the easy ways to think about the concept is to think
of model as being tightly coupled to the information model of the
domain you are working with.<p>In some cases this will be a catalog of
data, a stream of information coming from any number of sensing
mechanics, or active data that is some combination of massaged
information.<p>

Panu Viljamaa <panu@fcc.net_NOSPAM> wrote in message news:<3D09C1FD.D7267B32@fcc.net_NOSPAM>...

> The MVC pattern has three principal 'actors' after
> which it is named:  "Model, View, and Controller".
> A variation of MVC is  "Model-View-Presenter",
> as promoted in the Dolphin Smalltalk.
>
> I recently had the thought: "Why is the 'Model' called
> 'Model' in these patterns? What is a 'model'?"
>
> I discovered two quite different interpretations:
>
> 'Model' can mean a "model of the problem domain",
> which our program 'models' with its classes.
>
> Here the View is simply a 'window' or 'viewpoint'
> into that model, that shows it from a specific
> perspective. (This is what I always used to think
> 'model'  refers to). In this interpretation  the
> model is something we built, in order to represent
> something that exists in the 'real world'.
>
> But 'model' can also mean something like a 'fashion model',
> being photographed for a magazine, or a vase the painter
> is using as a 'model' for his painting. The model in
> this case is a "Real thing" (a person for instance). And
> here the term 'Presenter' fits nicely; we are for instance
> presenting someone in our magazine by taking their picture.
>
> In the first case the model (as in 'prototype') is already
> a presentation/representation of something. In the second
> something that exists as such (perhaps a mathematical formula),
> is being captured in a 'presentation' created by the presenter.
>
> What is your idea of the meaning of the word 'model' as used
> in MVC and MVP, and with software in general? Does it  matter
> which way we think about it?
>
> -Panu Viljamaa


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

michael
In reply to this post by Panu Viljamaa-5
>
> But 'model' can also mean something like a 'fashion model',
> being photographed for a magazine, or a vase the painter
> is using as a 'model' for his painting. The model in
> this case is a "Real thing" (a person for instance). And
> here the term 'Presenter' fits nicely; we are for instance
> presenting someone in our magazine by taking their picture.
>

idea -> concept -> model -> form -> type

yes, a fashion model is a concrete form to which the designer fits his
clothes.  And the fact that "the real thing" - the teenage girl whose going
to actually wear the design, may not conform to the model figure, doesn't
really matter - she will aspire to be the model girl, and get thin to
conform.

in the mvc thing, the model provides the stable type against which the
other actors are built.


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Graham Perkins-2
In reply to this post by Panu Viljamaa-5
> Showing an MVC architecture to someone who had never
> heard the term, how would we explain the reason why
> we are calling one specific object the 'model'?

You gotta stop somewhere.  Wanna show them some classic
Greek architecture and explain why we call that hard
lumpy thing a "stone".

-------------+ http://www.mk.dmu.ac.uk/~gperkins/


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

DavidVanCamp.com
In reply to this post by Panu Viljamaa-5
"Panu Viljamaa" <panu@fcc.net_NOSPAM> wrote in message
news:3D0A95E9.E8D2D848@fcc.net_NOSPAM...

> Graham Perkins wrote:
>
>
> So my question was both about MVC/MVP specifically,
> and  also more generally about how the use of the word
> 'model' relates to and contrast with other uses of it,
> in the domain of  systems building.
>
> Showing an MVC architecture to someone who had never
> heard the term, how would we explain the reason why
> we are calling one specific object the 'model'?
>
Because that is the name the designers picked for the object class a long
time ago. The concept is that the Model object 'models' some entity. Perhaps
they could have picked Entity. Microsoft picked the name 'Document' which
may seem more intuitive, but is less general.

--
David Van Camp.com :: Software Development Consulting
Patterns, Reuse, Software Process Improvement
http://www.davidvancamp.com

Visit the OO Pattern Digest :: http://patterndigest.com
A catalog of condensed patterns, books and related resources


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Universe-2
In reply to this post by michael
Abstraction, abstraction, abstraction...

Elliott
-
                  !Remember Tlatelolo!
RIP - RIG(lory) - 1968 Mexican Students Against FelonialU$m!


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Panu Viljamaa-5
In reply to this post by DavidVanCamp.com
David Van Camp wrote:

> ... The concept is that the Model object 'models' some entity. Perhaps
> they could have picked Entity.

But then it wouldn't *model* an Entity.

On the other hand, in some Smalltalk application the 'model'
might be a mathematical formula that only exists within the
computer's memory. In that case such a 'model' wouldn't model
anything, it would be the thing itself.

I guess 'model' is the best overall term.
But if I were to  reinvent MVC, I just might
just as well call it "TheThing(to be presented)".

Now, what about the choice between 'View' and 'Presenter' ?

-Panu Viljamaa

--
http://members.fcc.net/panu/SmalltalkTypes.htm


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

David Masterson
In reply to this post by Panu Viljamaa-5
>>>>> Panu Viljamaa writes:

> What is your idea of the meaning of the word 'model' as used
> in MVC and MVP, and with software in general?

Many years ago, there was a discussion on the net about the meaning of
a "real world" model with respct to relational database modeling.
Someone came back with the story of Lewis Carroll (of Alice in
Wonderland fame) and his perfect map of England.  This map showed
every street in England.  It showed every tree on every street.  It
showed every leaf on every tree.  After all, it was a perfect map of
England.  It was also a useless map of England because the first thing
you would need was a map of the map of England.  Did you catch the
point -- or do I have to draw you a map?  ;-)

The point was that a model, like a map, is necessarily an imperfect
representation of the area it depicts.  The usefulness of the model is
determined by the proper choosing of those imperfections.

--
David Masterson                David DOT Masterson AT synopsys DOT com
Sr. R&D Engineer               Synopsys, Inc.
Software Engineering           Sunnyvale, CA


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

DavidVanCamp.com
In reply to this post by Panu Viljamaa-5
"Panu Viljamaa" <panu@fcc.net_NOSPAM> wrote in message
news:3D0FCE69.FFE84C9D@fcc.net_NOSPAM...

> On the other hand, in some Smalltalk application the 'model'
> might be a mathematical formula that only exists within the
> computer's memory. In that case such a 'model' wouldn't model
> anything, it would be the thing itself.
>
Well, presumably the formula would be modeling something external to the
computer system....? (gravitational forces? stock market trends?) Or, at
least external to the 'model' object itself (memory garbage collection?)

Ah, well, just goes to show, not all models have to be beautiful to all
people...

"Now turn to the left and give me that pouty look, oh you beautiful
algorithm, you ....."  :D

--
David Van Camp.com :: Software Development Consulting
Patterns, Reuse, Software Process Improvement
http://www.davidvancamp.com

Visit the OO Pattern Digest :: http://patterndigest.com
A catalog of condensed patterns, books and related resources


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Panu Viljamaa-5
David Van Camp wrote:

> ,,,
> Well, presumably the formula would be modeling something external to the
> computer system....? (gravitational forces? stock market trends?) Or, at
> least external to the 'model' object itself (memory garbage collection?)

It might be something a monkey typed on the keyboard, in an application
that allows you to graph 2nd degree polynomials. Just a thought

Panu Viljamaa
--
http://members.fcc.net/panu/SmalltalkTypes.htm


Reply | Threaded
Open this post in threaded view
|

Re: Why is it called Model ?

Panu Viljamaa-5
In reply to this post by David Masterson
David Masterson wrote:

> The point was that a model, like a map, is necessarily an imperfect
> representation of the area it depicts.  The usefulness of the model is
> determined by the proper choosing of those imperfections.

Makes sense to me. A Map is a 'mapping' from something to something
(else). It is not an exact replication of the thing being 'mapped'.

-Panu Viljamaa

P.S.
Apologies to those readers of comp.lang.st.dolphin who think this
thread is getting  way too 'philosophical', for such a practical
newsgroup.  My original intention in posting to c.l.st.d was to
solicit feedback from the actual users of 'model-controller-presenter'.

--
http://members.fcc.net/panu/SmalltalkTypes.htm