Ljubomir zivanovic understandingmvvm-designpattern (1)

Preview:

Citation preview

Understanding MVVM Design PatternSilverlight adventures of asp.net developer

Ljubomir Zivanovicsenior software developer, netcetera

Background

Motivation

Huge number of new technologies & tools

[Almost] Daily announcements of new stuff

WPF, WCF, WF, Silverlight, .NET 4.0, LINQ, DLR, TPL

ASP.NET MVC, jQuery, SharePoint, VSTO, Odata, EF

Azure, Surface, XNA, Windows 7, WP7, MEF, F#

Motivation

impressions

WP7 & Silverlight = dream team!

MVVMSilverlight

WP7HTML5

Situation

Q: How to jump to SL/WP7 Bandwagon in a most efficient way?

A: Hands on - Download WP7 SDK and start playing

Getting started

My First WP7 Silverlight project

DEMO

Demo feedback

Similarities with ASP.NET:

Identical code behind architecture

XAML [is similar to] HTML markup

XAML [looks like] C# object initialization notation

Well known environment

Leveraging Lessons Learned

Same architectural patterns apply to this environment as well.

RAD development practices are OK for one-hour projects

For something even slightly complicated we need better

architecture – here comes MVVM…

Meet MVVM

Model View ViewModel

Why use it?

What it solves?

Benefits?

View

View Model

Model

The Star - ViewModel

View ModelCode

Model(Domain, SQL, File,

Memory...)

View(XAML)

User Interface (pages, controls)

Services

Getting started with MVVM

My Second WP7 Silverlight project

DEMO

What’s in it for me?

Maintainability

Testability

Blendability

Separation of concerns

Why is ViewModel pushed

There is a huge shift in paradigm involved:

meet

Developers are not the only ones responsible for their applications!

How is ViewModel supported

Vast amount of available tools & frameworks that support MVVM:

Prism, MVVM Light, Caliburn, …..

They helps a lot and speedup your development process and adding benefits at the same time

Reverse analogy…

IF Silverlight [has similar architecture to] ASP.NET

AND Silverlight [benefits from] MVVM

THEN ASP.NET [can benefit from ?] MVVM

Result: http://aspnetmvvm.codeplex.com/

MVVM on other platforms

Q&A Session

• Complete an evaluation form and enter to win!– Telerik Ultimate

Collections

– Pluralsight yearly subscriptions

– JetBrains Tools

– RedGate .NET Profiler Pro or other tools

– O’Raily books

– Component One Suites

– CodeSmith Tools

– and many more…

06th November, FON University