19

Click here to load reader

MVVM

Embed Size (px)

DESCRIPTION

Presentation about the MVVM pattern and some experiences of different MVVM frameworks for Windows Phone 7.

Citation preview

Page 1: MVVM
Page 2: MVVM

MVVM

Johan Lindfors

Page 3: MVVM

model-view-viewmodel

view

viewmodel

model

Page 4: MVVM

separation of concerns

• modularity

• loose coupling

• role separation

• tool friendly

• maintainability

• less code

• testability

Page 5: MVVM

separation of concerns

• role separation

• tool friendly

• less code

Page 6: MVVM

”everybody wants choices,

no one wants to choose”

Page 7: MVVM
Page 8: MVVM

• role separation

• tool friendly

• less code

+ ++ + -

++ + + -

+ + ++ -

Page 9: MVVM

• role separation

• tool friendly

• less code

• coolness

+ ++ + -

++ + + -

+ + ++ -

- + + ++

Page 10: MVVM

• modularity

• loose coupling

• role separation

• tool friendly

• maintainability

• less code

• testability

• coolness

- + + ++

- + + ++

+ ++ + -

++ + + -

++ + - +

+ + ++ -

- + + ++

- + + ++

Page 11: MVVM

demo

Page 12: MVVM

model

• platform independence?

• PortableClassLibrary?

• [DataContract]

Page 13: MVVM

view

• xaml

• popups

• animations

• dispatcher

Page 14: MVVM

view-model

• encapsulation or incorporation of model?

• instantiation?

1. per view/page in code

2. per view/page in xaml

3. per application instance

4. using view-model-locator

• converters or conversions?

Page 15: MVVM

design time

• mock service or view model?

• what about demo time?

using System.ComponentModel; ... if (DesignerProperties.IsInDesignTool) { }

Page 16: MVVM

lesson learned

design code

Page 18: MVVM

resources

• www.mvvmexplained.com

• caliburnmicro.codeplex.com

• mvvmlight.codeplex.com

• compositewpf.codeplex.com

• programmeramera.se

• www.coderox.se

Page 19: MVVM