Silverlight is dead! Long live MVVM! maciej.grzyb@makingwaves.pl.

Post on 01-Apr-2015

217 views 0 download

Transcript of Silverlight is dead! Long live MVVM! maciej.grzyb@makingwaves.pl.

Silverlight is dead!Long live MVVM!maciej.grzyb@makingwaves.pl

A long time ago…

… when all we had

were Win Forms…

… Microsoft released

Silverlight/WPF

What’s changed?

Declarative UI (XAML)

UI thread belongs to the UI

Your Weather App is not responding

UI thread belongs to the UI

Non absolute layouts

MVVM & Data Binding

View Model

View Model

MVVM – Model View ViewModelBoring diagrams

Separated presentation

DomainObjects

View

Presentation Logic

Different responsibilities

DomainObjects

View

Presentation Logic

User name cannot be empty

When user name entry is empty,

disable submit button

MVVM - Structure

Invoke Commands

Change notifications

DEMO TIME

Old (ancient) idea

View Model!=

Code Behind

DEMO TIME

This MVVM thing is pretty cool.

Silverlight RULEZ!

Silverlight is D E A D !

Silverlight is dead – O RLY?

• Silverlight 5 is a complete platform– Support through 10/12/2021

• WP 7.5/8• WPF

• Yup, it is pretty dead on the web…

Domain Objects

Separated presentation in a browser

View Model

View Model

MVVM in the browser

1032 pages

172 pages

View Model

View Model

MVVM in the browser

?

Simplify dynamic JavaScript UIs by

applying the Model-View-View Model

(MVVM) pattern

Declarative

Bindings

Automatic UI

Refresh

Dependency

TrackingTemplating

DEMO TIME

KnockoutJS Demo

• MVVM pattern– Data binding– Observables– Commands

• Custom bindings

• Promises and Deferred objects

Final (almost) thoughts

• Silverlight is dead (on the web)!

• JavaScript is here to stay… we need client side code…

• JavaScript has good parts– Object oriented– Functional– Dynamic

Final thoughts• There is more to explore and learn

– HTML5, CSS3– REST, JSON– Web Sockets– Web Storage– Worker Threads– Canvas– Audio/Video

Technology changes – focus on principles

Knockout @ Making WavesActivity Feed (activityfeed.codeplex.com)

Forms Designer