ViewModels

FeatureIn DXADD4T .NETDD4T JavaComments
Features of the models
Attribute-drivenYesYesYesBoth attributes will be backwards compatible, but will choose one preferred one for future usage, try to consolidate/minimise use of attribute. Metadata could be separate property, but does not have to be
Support for strongly typed page modelsYesYesPartial
Support for page regionsYes (in generic pages)Yes (in custom page models)No

Regions in DXA are created in the generic page to group CPs, in DD4T there are attributes to let you model this on the page. Regions should be in the Generic page model and have a pluggable region mapper.

Link and rich text resolvingYesYesYes

Linking: Needs to be in the model and extendible. Mark properties as dynamic to decide on the spot.

Rich Text: Needs to be in the model and extendible. DXA has a type which can contain html but also full entity models, should be an implementation of the rich text models

Multiple attributes on a propertyYesNoYesNeed to be clear on ordering and functional logic DXA and Java do it but maybe differently
Search in a tree structure (Flattening)YesNoNoGood feature, but it must be made optional. Should only go into embedded fields and not linked components. Should this be enabled/disabled on a property basis, model basis or implementation basis?
Semantic vocabularies (eg schema.org) supportYesNoNoDXA currently requires that schema information published separately (publish settings page) - this is a bit of a pain so we should look at putting the semantics info in the DD4T JSON.
Multiple schemas per viewmodelYesNoYes
Multiple viewmodels per schemaYesYesYes
Extensible attributesNoYesNoCleanup necessary.
Lazy properties?NoNoNoNot needed in the framework - up to implementation - not really what MVC is about. DXA has ability to ignore individual properties, or all properties on the model by default which do not have attributes for mapping.
Implicit mappingsYes?NoUse existing conventions from DXA

Self linking

Yes?BugDXA uses a reserved "_self" 'field' name in the attributes for this
Map all properties to DictionaryYesNoNoDXA Can map all schema fields to a single property of type dictionary/map - used for configuration models
Selecting expansion of component links on publishingNoNoNoQuirijn's GUI extension to be able to define this on the schema - should be productized! This still respects the Link Level parameter as a max level to allow links to
Features of the model builder
Bulk link resolvingNoNoNoWeb8 architecture means a lot of http traffic can be generated as links are discovered and resolved when mapping models - this is a performance concern. CIL contains a bulk linking capability we we should use.
Uses reflection only onceNoYesYesDD4T reads all model information only once (using reflection), and uses it many times
Independent from MVCYesYesYesIt must be possible to use the ViewModels outside the context of MVC to facilitate testing etc
Injecting ExternalContentProvidersNoNoNoController/Model Builders are responsible for model enrichment. This feature should follow the same model as the current dd4t pattern of Controller > Factory > Provider. The factory then would be the place to process external content, whether or not that is in combination with extending data binding classes and / or view model attributes.
Single-step approach (from json to strongly typed object)NoNoYesNice to have - interesting to know what if any performance gain this gives. Needs to be extendible in the same way as you have modelbuilder pipeline. Needs to be EASY to create your own attributes.
Inject viewmodels using ModelBinderNoYes (in feature branch)NoThis belongs in the MVC discussion and not the model mapping discussion
Support for older viewmodel architectures (DXA and DD4T)NoNoNoImportant to offer an upgrade path for all customers! No need to go into bespoke DD4T view model implementations pre 2.0
Mapping Troubleshooting toolNoNoNoOften a view developer will have the question "Why is this property not mapped?". They cannot be expected to debug the model mapper, so there should be some kind of tool where you can provide as input the raw data (DD4T JSON or even perhaps Tridion XML) and the model definition, and see how its mapped - visually if possible, but also with plenty of useful debug logging.