ViewModel
No edit summary
No edit summary
Line 3: Line 3:
[[Category:Beginner]]
[[Category:Beginner]]
[[Category:The MDriven Book]]
[[Category:The MDriven Book]]
View models in MDriven are a core piece of the framework.  The UML model contains all the information of the application but doesn't have clear perspectives or views of how that information should be used.  It's a generalized bucket of data.  The views, on the other hand, puts perspective on the modeled information. Views are used for several things in an M driven framework application.  The most common is the user interface of the application,  but others are creating APIs that are either read only or read right,  the same way the user interface, a lot of times are both read and write.  The view model is also used for extracting data either as JSON or XMLor to create reports either as XML exports,  or by using the report feature, it can be merged to the output data of the view,  and can be merged into reports using ODS or ODT,  Open Document Standard Forma Documents.  When the data is used that way from a view model,  each tag in the document is replaced by a piece of information from the view models structure.  In general terms, the view model unfolds a piece of your model  and navigates through the different links for associations in your model to show some aspects of the application's data.  The view models come into distinct ways, formatsthat is, the rooted and the unruited view model.  The unruited view models are used to find the data for searching.  They are called unruited because they don't have a specific object in your database or models as their starting point. Instead, they are used to search or in other ways find objects by searching the database  and showing that object or many objects in a list.  The rooted view models have a specific object as their starting point.  For example, a person or something that is modeled specifically in your application. From that root object, the view model or the view navigates through associations  to show things related to the root object.  There is nothing preventing a rooted view to show any object in the database  but it's usually an object associated somehow to the root object.
ViewModels in MDriven is a core piece of the Framework. The UML model contains all the information of the application but doesn't have clear perspectives or views of how that information should be used. It's a generalized bucket of data. The views, on the other hand, puts perspective on the modeled information.
 
==== Application ====
Views are used for several things in an MDriven Framework application.  The most common is the user interface of the application,  but others are creating APIs that are either read-only or read-right,  the same way the user interface, a lot of times is both read and write.   
 
The ViewModel is also used for extracting data either as JSON or XML or to create reports either as XML exports or by using the report feature, it can be merged to the output data of the view and can be merged into reports using ODS or ODT,  Open Document Standard Format Documents. When the data is used that way from a view model, each tag in the document is replaced by a piece of information from the ViewModel's structure. 
 
In general terms, the ViewModel unfolds a piece of your model and navigates through the different links for associations in your model to show some aspects of the application's data. 
 
==== Rooted and Unrooted ViewModels ====
The ViewModels come in two distinct ways/formats - that is, the rooted and the unrooted ViewModel. The unrooted ViewModels are used to find the data for searching. They are called unrooted because they don't have a specific object in your database or models as their starting point. Instead, they are used to search or in other ways find objects by searching the database and showing that object or many objects in a list. The rooted ViewModels have a specific object as their starting point - for example, a person or something that is modeled specifically in your application. From that root object, the ViewModel, or the view navigates through associations to show things related to the root object. Nothing prevents a rooted view from showing any object in the database, but it's usually an object associated somehow with the root object.

Revision as of 06:13, 9 August 2023

ViewModels in MDriven is a core piece of the Framework. The UML model contains all the information of the application but doesn't have clear perspectives or views of how that information should be used. It's a generalized bucket of data. The views, on the other hand, puts perspective on the modeled information.

Application

Views are used for several things in an MDriven Framework application.  The most common is the user interface of the application,  but others are creating APIs that are either read-only or read-right,  the same way the user interface, a lot of times is both read and write. 

The ViewModel is also used for extracting data either as JSON or XML or to create reports either as XML exports or by using the report feature, it can be merged to the output data of the view and can be merged into reports using ODS or ODT,  Open Document Standard Format Documents. When the data is used that way from a view model, each tag in the document is replaced by a piece of information from the ViewModel's structure. 

In general terms, the ViewModel unfolds a piece of your model and navigates through the different links for associations in your model to show some aspects of the application's data. 

Rooted and Unrooted ViewModels

The ViewModels come in two distinct ways/formats - that is, the rooted and the unrooted ViewModel. The unrooted ViewModels are used to find the data for searching. They are called unrooted because they don't have a specific object in your database or models as their starting point. Instead, they are used to search or in other ways find objects by searching the database and showing that object or many objects in a list. The rooted ViewModels have a specific object as their starting point - for example, a person or something that is modeled specifically in your application. From that root object, the ViewModel, or the view navigates through associations to show things related to the root object. Nothing prevents a rooted view from showing any object in the database, but it's usually an object associated somehow with the root object.

This page was edited 126 days ago on 01/11/2024. What links here