Architecture

Published on August 2018 | Categories: Documents | Downloads: 7 | Comments: 0 | Views: 210
of 4
Download PDF   Embed   Report

Comments

Content

Architecture The Code-behind architecture The current setup of Insight at KipMcGrath uses a code-behind architecture architecture for its implementation. This early technology from Microsoft filled a gap in the .NET framework in terms of separation of layers. It provided an easy way to have data access and logic separated from the UI. However, in most cases, cases, the code-behind is closely closely connected with the the UI. This tight coupling between the two layers does not render it easy to manage or grow. For small applications this architecture is well suited and serves the purpose very well. But, as the application’s complexity grows, this architecture becomes difficult to manage. An architecture with more loosely coupled layering is preferred. The current Insight code base uses codebehind.

There are now several newer implementations of architectures that are suited for an application like the KipMcGrath. MVC and MVVM MVVM are two such architectures. architectures. MVVM is more suited for a longer term solution. We will discuss this below. MVC architecture The Model-View-Controller architecture is a more flexible architecture with separation of functions defined better. The three components of the architecture are representative and actual implementations may choose to represent them differently. But, in all cases the general underlying idea behind the architecture is the same. The user interfaces with the controller. The controller coordinates with the view and model layers to retrieve, process and represent data. The view manages the structuring of information that is shown to the user. The model is the interaction layer for the data sources. It does business logic and returns data to the controller

which selects an appropriate view. The controller, then, has complete visibility of the user, model and view. The layers in this case are loosely coupled. This means extensibility is possible with little disruption to other layers. Development can be disconnected and so can testing. This improves maintainability of the code base. The architecture allows creating views that are driven by events. The vi ews are dependent on the data requested/triggered by the user. This event driven method allows the designer to think in terms of use cases. This approach gives a better user experience and sophistication of the application. Unlike the older model of working where the data and views are tied together, this architecture allows views to be customized and evolved independent of the other layers. Microsoft has implemented this architecture for Web applications in .NET. However, this architecture does have a downside when it comes to maintaining state and enriching user experience where mobility plays a key role. The MVVM architecture is better suited for today’s web applications that span a variety of devices and connectivity mechanisms. The state management apart from the UI separation is well handled in the MVVM architecture which places it in a better suited position for applications that are rich in the variety of target platforms they support.

The figure below shows how the separation of presentation is achieved and how the user interacts with the application through the controller.

Source: http://devnet.kentico.com/articles/files/thomas-robbins/mvc/image001

MVVM architecture The Model-View-ViewModel architecture, as we can see from the naming, does away with the controller. The View talks to the UI directly. The ViewModel abstracts the data used by the View. This architecture was proposed with UI separation in mind. This allows UI designers to focus on and build views for different renderings. Additionally, in implementations such as Konckout.js, the concept of Observables is provided. This allows views to be automatically updated when the viewmodel changes. The Silverlight/XAML technology is a MVVM based implementation. There are however other implementations like KnockOut.js that are popular. These can be used with HTML5 and integrated with a Microsoft MVC backend.

What do we choose? Both the MVC and MVVM architectures are good for our needs. The newest version of Microsoft’s MVC includes a ViewModel which brings it closer to a MVVM model. The use of a controller, then, becomes the primary differentiating factor between the two. Using a controller does not necessarily place us in a bad place but it does add the overhead of creating controller-view pairs for each view. If we avoid the controller, then the view changes according to the target while the viewmodel takes care of separating the data associated with it.

In order to gain the benefit of separation of presentation (UI) from logic and data, the MVC pattern holds the best path forward. However, some tweaks to this architecture to support MVVM style UI benefits are needed.

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close