Mental Model(s) and MVC-U

43 views
Skip to first unread message

Marius - Adrian Francu

unread,
Nov 28, 2019, 3:25:30 PM11/28/19
to object-composition

Hi all. For a year or so a realized an important thing: is very hard for a person who has some experience to unlearn things.

When I saw that Model from MVC-U comes from the idea of mental models was like an earthquake for me. So , for me was time to make a ‘tabula rasa’ and this take time 😊.

 

Context:

At the end of last year, I become aware of a thing which was in front of my eyes, but I was not able to see it.

 

I was struggling to understand a system. This system was split in half, if I can say so – I know it sounds strange, but this is how I perceive it and how the programmers saw it. One half was on client side, implemented in Vue the other side on server with .NET. I personally dislike when I see a system describe in such a way, but this is what I ‘breathed’ there.

 

This system became very hard to modify on both sides. Literally people were blocked. I would have not imagined ever to see people being blocked in implementing a simple form.

 

Please imagine a form with 3 text boxes and 3 drop downs. The drop-down values were taken from server, but each with different server calls. And the code from the server for serving data for these drop downs were in separate locations. So, on the server side it was impossible for me to see an entry point serving a common structure in code which was needed to work with that form. I thought I would see it in client-side code, but no. I would have like to see a portion of the code, to see together all what is needed to work with that form in a nice way.

 

Then I recalled the work of Trygve and James. When I was speaking with the end user about that form, I begun to be very careful to the words the end user used. Is clear that he was seeing 6 simple concepts together which in, that moment, happened to be represented via a form. I tried then to look in the code for the exact words. I did not fond them. I would have expected to see a simple, dumb structure which would have hold together those 6 things. I found nothing. Everything was scattered in the UI, the same on the server. No fluency/fluidity between the UI and server side.

 

Questions:

- I remembered I read that Trygve said that “there are many variants of MVC”. But now I am thinking to the simplest form. I would have liked in that code to see the mental model represented explicitly, a simple dummy object(or data structure) but with naming used by the end user not something else to represent that form. It was not a complex scenario, not at all. Did I get the thing with Model and how should be represented in code?

- The Model is there for being used in a single perspective the user has, when trying to work on, a specific thing/concept/idea. We can imagine 2 ui’s for the same concept. Example of specific thing/concept/idea: signal sent from a sensor. A sensor will have a value, a quality field specifying the quality of signal, type,… . Whether we display this signal(s) in chart or grid is a different story.  Does it make sense? Did I get it?

 

Conclusion:

Seeing a system from this perspective of mental models and noticing that in code I can’t find the words and structure to represent this model, is fantastic. I began to see how the technicalities (coupling, cohesion, …) are subordinated to/guided by this perspective not vice-versa.

 

I tried to write these words for some time now. If I am wrong is ok. Help me out, please, with a hint.

 

Thank you

Marius

Trygve Reenskaug

unread,
Nov 29, 2019, 9:50:17 AM11/29/19
to object-co...@googlegroups.com, Marius - Adrian Francu
Hi Marius
You are not wrong, you are right.

This is how I read you. You have the human mental model on the one hand and an implementation with a number of different server calls on the other. You insert a Facade object between user and server calls. (See GOF: Design Patterns). The facade provides a uniform set of operations that exposes the Model as seen from the user while it hides the implementation of the various server calls. You can implement any number of Views on the human side of the facade without changing the Model. And  you can refine the Model with its server calls without changing the Views. It's all very nice and tidy.

Best
--Trygve



On 28.11.2019 21:25, Marius - Adrian Francu wrote:

Hi all. For a year or so a realized an important thing: is very hard for a person who has some experience to unlearn things.

A sad truth. People are still programming in essentially the same way as they did in 1948. This in spite of deep problems with reliability, security, and privacy.

Marius - Adrian Francu

unread,
Nov 29, 2019, 11:02:30 AM11/29/19
to object-composition
Thank you a lot Trygve.
Reply all
Reply to author
Forward
0 new messages