Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shailen Sukul Senior Solutions Architect EMC BSc | Mct | Mcpd (.Net 2/3.5) | Mcts (Sharepoint (MOSS/WSS), Biztalk, Web, Win, Dist Apps) | Mcsd.NET | Mcsd.

Similar presentations


Presentation on theme: "Shailen Sukul Senior Solutions Architect EMC BSc | Mct | Mcpd (.Net 2/3.5) | Mcts (Sharepoint (MOSS/WSS), Biztalk, Web, Win, Dist Apps) | Mcsd.NET | Mcsd."— Presentation transcript:

1 Shailen Sukul Senior Solutions Architect EMC BSc | Mct | Mcpd (.Net 2/3.5) | Mcts (Sharepoint (MOSS/WSS), Biztalk, Web, Win, Dist Apps) | Mcsd.NET | Mcsd | Mcad)

2

3 In addition to that, the target framework (4.0) on the unit test project in Visual Studio 2010 cannot be changed which makes testing against SharePoint 2010 (.Net 3.5) difficult.

4

5 …For your information, there's a lot more to ogres than people think... ….Ogres have layers. Onions have layers. You get it? We both have layers…

6 Model-view-presenter (MVP) is a user interface design pattern engineered to facilitate automated unit testing and improve the separation of concerns in presentation logic. The model is an interface defining the data to be displayed or otherwise acted upon in the user interface. The view is an interface that displays data (the model) and routes user commands (events) to the presenter to act upon that data. The presenter acts upon the model and the view. It retrieves data from repositories (the model), persists it, and formats it for display in the view.

7 The Model View ViewModel (MVVM) is an architectural pattern used in software engineering that originated from Microsoft as a specialization of the Presentation Model design pattern introduced by Martin Fowler.

8 Elements of the MVVM pattern include: Model: as in the classic MVC pattern, the model refers to either (a) an object model that represents the real state content (an object-oriented approach), or (b) the data access layer that represents that content (a data-centric approach). View: as in the classic MVC pattern, the view refers to all elements displayed by the GUI such as buttons, windows, graphics, and other controls. ViewModel: the ViewModel is a “Model of the View” meaning it is an abstraction of the View that also serves in data binding between the View and the Model. It could be seen as a specialized aspect of what would be a Controller (in the MVC pattern) that acts as a data binder/converter that changes Model information into View information and passes commands from the View into the Model. The ViewModel exposes public properties, commands, and abstractions. The ViewModel has been likened to a conceptual state of the data as opposed to the real state of the data in the Model. Controller: some references for MVVM also include a Controller layer or illustrate that the ViewModel is a specialized functional set in parallel with a Controller, while others do not. This difference is an ongoing area of discussion regarding the standardization of the MVVM pattern.

9 Although MVVM was primarily designed for WPF/Silverlight, the basic principles of modularity and separation of concerns can be applied to SharePoint development, barring some technical challenges. In this article, I will show you how to structure a SharePoint project to derive a lot of the same benefits out of MVVM. Lets take a look at how the sample webpart project can be retrofitted into the MVVM paradigm.

10

11

12

13

14

15 As you can see, with a little refactoring, you can get test coverage for a large percentage of your SharePoint code with little effort. Unit testing is does not depend on having access to the SharePoint context, this is now delegated to the web service. There are still gaps in testing the ViewModel (i.e. the javascript controller). There are fameworks like JSUnit that allow testing javascript and will be explored in a later article.JSUnit

16

17

18


Download ppt "Shailen Sukul Senior Solutions Architect EMC BSc | Mct | Mcpd (.Net 2/3.5) | Mcts (Sharepoint (MOSS/WSS), Biztalk, Web, Win, Dist Apps) | Mcsd.NET | Mcsd."

Similar presentations


Ads by Google