MVC RANDOMS
Tags: mvc, code
Published: 2024-02-21 10:44:08

---
title: MVC RANDOMS
published: true
description: Random views and examples on MVC. Personal
tags: MVC,Code
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-02-21 10:39 +0000 
---

Unedited, random as the just come to my head
Model view controller

Everything has a model even a model is a model of itself
Controller controls/works on/over a model

ModelController is trivially redundant since controller works on model anyway.(Think about adding model features without extending with a new class. Maybe using ModelExtender?)

ViewContoller- controls a view via its model. Controls a model that we just happen to know is for a view. Restricted to be controlling views only. Otherwise it is just a controller working some model.
ViewModel- same as 8* above but for Model. Only change it if you want to change what the stuff of/in a Model is (made/made up of) .

ControllerModel- model of a controller. If you want to control a controller using another controller. Like a Process controlling another process. E.g of that is when creating/instantiating a new Controller instance.

Controller controls CRUD operations for any model it is given and for
any of its functions/behaviors. Eg. If the model is 

Page for displaying a table
Example:
Page is a View. PageController is a controller, PageModel is a Model
Table is a Model.
We want to View(Table). So we need the models for View and Table. We need a Controller for view,page and table. Controller instance is from ControllerModel.

//new Controller(Object extends Model)
aTable new Table()
aView new View()
aPage new Page()
viewController new Controller(View)
pageController new Controller(Page)
tableController new Controller(Table)

//Now we want to put the Table on the Page and View the Page
aPage.put(Table)
aView.put(Page)
aView.do()//show the result of the verb "view" so that Viewer can do 
//OR Viewer.do(View) if we have a new View passed in from some external scope or if Viewer can also do other external doable things like spin() for example. Viewer.do(Spin) which calls Spin.do() equivalent to Spin.do(selfReference)
Viewer.view(Page). Viewer has View that holds objective form of view() eg. She view Page, results in a View with the Page being viewed.
//If we call view(Table), it implies create a Page and Page.put(Table)  then View.put(Table), aView.show() internally 

Notice how all of these models going into the controller are from verbs. They are things you can do. But since controller only needs a model, it means we can give it something that is not from a verb E.g Person. You can't "Person" around. It is not an activity. But we can still pass it to the controller.  So we might think of "model" as a verb or also think that we are controlling the set of all verbs applicable to/on/from the provided model. So Controller controls CRUD operations for any model it is given and for
any of its functions/behaviors. Eg. If the model is for Person, it controls CRUD(construct/destruct/update/Access) [CreateAccess(rwx)Destroy] or if the Person has some jump function, we spin off a 
Jump aJump= new Person.jump(aBarrier){//returns Jump.initialize()} jumpController= new Controller(Jump);