Architecting WPF Applications<br />Paul Stovell<br />Senior Consultant<br />WPF Technical Specialist<br />Readify<br />
Agenda<br />WPF Overview<br />Inductive vs. Deductive UI<br />Navigation<br />Presentation Patterns<br />Composition<br />...
WPF Overview<br />
Unified Presentation<br />
Web or Windows?<br />Windows<br />Intranet                 Internet<br />Silverlight<br />Windows Forms<br />Java<br />Jav...
XBAP<br />
XBAP<br />
WPF Releases<br />.NET Framework 3.0<br />.NET Framework 3.5<br />.NET Framework 3.5 Service Pack 1<br />.NET Framework 4....
Inductive vs. Deductive<br />
Deductive UI<br />
Deductive UI<br />
Inductive UI<br />
Inductive UI<br />
Inductive vs. Deductive<br />Why does it matter?<br />UI composition Patterns<br />Navigation Patterns<br />Service Layer<...
DataGrid<br />
Navigation<br />
Linked List<br />Page 1<br />Page 2<br />Page 4<br />Page 3<br />
Centralized Decisions<br />Navigation Handler<br />Page 1<br />Page 2<br />Page 3<br />Page 4<br />
Presentation Patterns<br />
Presentation Patterns<br />Model-View-ViewModel<br />aka Presentation Model<br />Model-View-Presenter<br />aka Supervising...
Model View ViewModel<br />Change Address View<br />Model<br />Customer<br />Address<br />Accounts<br />Change Address View...
Model View ViewModel (Wrapped)<br />View Model<br />Change Address View<br />Customer VM<br />Account VM<br />Address VM<b...
Model View Presenter<br />Change Address View<br />Model<br />Customer<br />IChangeAddressView<br />Address<br />Accounts<...
Model View Presenter with VM<br />Change Address View<br />Model<br />Customer<br />Change Address ViewModel<br />IChangeA...
Model View Controller<br />Controller<br />View 1<br />Model 1<br />View 2<br />Nav Request<br />Model 2<br />View 3<br />...
Presentation Patterns<br />Things to consider:<br />Does every view need separated presentation?<br />Does every view need...
UI Composition<br />
Model-based Composition<br />Recent Orders ViewModel<br />Search ViewModel<br />Weather ViewModel<br />Order List<br />Sea...
UI-based Composition<br />Bottom-Up<br />Order List<br />Top Region<br />2. Place<br />Navigation<br />Bottom Region<br />...
UI-based Composition<br />Top-Down<br />Order List<br />Top Region<br />Bottom Region<br />Search<br />Weather<br />
Inter-View Communication<br />
Inter-View Communication<br />Standard .NET events<br />Search Model<br />Child model raises event<br />Parent model forwa...
Inter-View Communication<br />Event Aggregator<br />Results Model<br />Criteria Model<br />hub<br />Publish<br />Handle<br...
Event Aggregator<br />Advantages:<br />Automatic thread switching<br />Weak events<br />Hook for cross-cutting concerns<br />
Dependency Injection<br />
Dependency Injection<br />
Partitioning<br />
Partitioning<br />Splitting partitions:<br />By SKU<br />By feature<br />By team<br />By department<br />
Partitioning<br />Managing partitions:<br />With solutions<br />With projects<br />With assemblies<br />
Partitioning<br />Resolving:<br />Hard-coded<br />Config<br />Discovery<br />
Partitioning<br />Also consider:<br />Deployment and patching<br />Inter-partition dependencies<br />Dev time vs. build ti...
Partitioning<br />Remember: assemblies are like water<br />necessary for life…<br />…but too much can kill you!<br />
Leveraging XAML<br />
Abstractions<br /><Grid><br />   <..><br />   <Label <br />Grid.Row="0" Grid.Column="0" <br />       Content="First Name:"...
Consistency<br /><TextBlock<br />   Foreground="Red"<br />  Text="Please enter..."   /><br /><TextBlock<br />   Foreground...
Style Catalogues<br /><TextBox Width="300" .../><br /><TextBox Width="156" .../><br /><TextBox Width="215" .../><br /><Tex...
Behaviours<br />Consider this:<br />Developers don't write code; they build tools for designers<br />
Performance Considerations<br />
Performance Considerations<br />Retained scene vs. Immediate Mode<br />Virtualization (data and UI)<br />Memory leaks<br /...
Q&A<br />Links:<br />http://www.codeplex.com/CompositeWPF<br />http://magellan.codeplex.com<br />http://www.galasoft.ch/mv...
Upcoming SlideShare
Loading in …5
×

Architecting WPF Applications

5,166 views

Published on

A presentation given at the Sydney Architecture User Group.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,166
On SlideShare
0
From Embeds
0
Number of Embeds
345
Actions
Shares
0
Downloads
216
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Architecting WPF Applications

  1. 1. Architecting WPF Applications<br />Paul Stovell<br />Senior Consultant<br />WPF Technical Specialist<br />Readify<br />
  2. 2.
  3. 3. Agenda<br />WPF Overview<br />Inductive vs. Deductive UI<br />Navigation<br />Presentation Patterns<br />Composition<br />Inter-view Communication<br />Dependency Injection<br />Partitioning<br />Leveraging XAML<br />Performance Considerations<br />
  4. 4. WPF Overview<br />
  5. 5. Unified Presentation<br />
  6. 6. Web or Windows?<br />Windows<br />Intranet Internet<br />Silverlight<br />Windows Forms<br />Java<br />Java Applets<br />ASP.NET<br />WPF XBAP<br />WPF<br />AJAX<br />
  7. 7. XBAP<br />
  8. 8. XBAP<br />
  9. 9. WPF Releases<br />.NET Framework 3.0<br />.NET Framework 3.5<br />.NET Framework 3.5 Service Pack 1<br />.NET Framework 4.0<br />
  10. 10. Inductive vs. Deductive<br />
  11. 11. Deductive UI<br />
  12. 12. Deductive UI<br />
  13. 13. Inductive UI<br />
  14. 14. Inductive UI<br />
  15. 15. Inductive vs. Deductive<br />Why does it matter?<br />UI composition Patterns<br />Navigation Patterns<br />Service Layer<br />ChangeAddress vs. SaveCustomer<br />
  16. 16. DataGrid<br />
  17. 17. Navigation<br />
  18. 18. Linked List<br />Page 1<br />Page 2<br />Page 4<br />Page 3<br />
  19. 19. Centralized Decisions<br />Navigation Handler<br />Page 1<br />Page 2<br />Page 3<br />Page 4<br />
  20. 20. Presentation Patterns<br />
  21. 21. Presentation Patterns<br />Model-View-ViewModel<br />aka Presentation Model<br />Model-View-Presenter<br />aka Supervising Controller<br />Model-View-Controller<br />
  22. 22. Model View ViewModel<br />Change Address View<br />Model<br />Customer<br />Address<br />Accounts<br />Change Address ViewModel<br />
  23. 23. Model View ViewModel (Wrapped)<br />View Model<br />Change Address View<br />Customer VM<br />Account VM<br />Address VM<br />Change Address ViewModel<br />Model<br />Customer<br />Account<br />Address<br />
  24. 24. Model View Presenter<br />Change Address View<br />Model<br />Customer<br />IChangeAddressView<br />Address<br />Accounts<br />Change Address Presenter<br />
  25. 25. Model View Presenter with VM<br />Change Address View<br />Model<br />Customer<br />Change Address ViewModel<br />IChangeAddressView<br />Address<br />Accounts<br />Change Address Presenter<br />State<br />Behaviour<br />
  26. 26. Model View Controller<br />Controller<br />View 1<br />Model 1<br />View 2<br />Nav Request<br />Model 2<br />View 3<br />Model 3<br />
  27. 27. Presentation Patterns<br />Things to consider:<br />Does every view need separated presentation?<br />Does every view need to follow the same pattern?<br />Code Behind isn’t Evil (DataGrids are)<br />MVPoo<br />
  28. 28. UI Composition<br />
  29. 29. Model-based Composition<br />Recent Orders ViewModel<br />Search ViewModel<br />Weather ViewModel<br />Order List<br />Search<br />Weather<br />
  30. 30. UI-based Composition<br />Bottom-Up<br />Order List<br />Top Region<br />2. Place<br />Navigation<br />Bottom Region<br />1. Resolve<br />Search<br />Weather<br />
  31. 31. UI-based Composition<br />Top-Down<br />Order List<br />Top Region<br />Bottom Region<br />Search<br />Weather<br />
  32. 32. Inter-View Communication<br />
  33. 33. Inter-View Communication<br />Standard .NET events<br />Search Model<br />Child model raises event<br />Parent model forwards event<br />Results Model<br />Criteria Model<br />
  34. 34. Inter-View Communication<br />Event Aggregator<br />Results Model<br />Criteria Model<br />hub<br />Publish<br />Handle<br />Publish<br />Handle<br />Advert Model<br />Recent Searches Model<br />
  35. 35. Event Aggregator<br />Advantages:<br />Automatic thread switching<br />Weak events<br />Hook for cross-cutting concerns<br />
  36. 36. Dependency Injection<br />
  37. 37. Dependency Injection<br />
  38. 38. Partitioning<br />
  39. 39. Partitioning<br />Splitting partitions:<br />By SKU<br />By feature<br />By team<br />By department<br />
  40. 40. Partitioning<br />Managing partitions:<br />With solutions<br />With projects<br />With assemblies<br />
  41. 41. Partitioning<br />Resolving:<br />Hard-coded<br />Config<br />Discovery<br />
  42. 42. Partitioning<br />Also consider:<br />Deployment and patching<br />Inter-partition dependencies<br />Dev time vs. build time partitioning<br />
  43. 43. Partitioning<br />Remember: assemblies are like water<br />necessary for life…<br />…but too much can kill you!<br />
  44. 44. Leveraging XAML<br />
  45. 45. Abstractions<br /><Grid><br /> <..><br /> <Label <br />Grid.Row="0" Grid.Column="0" <br /> Content="First Name:" <br /> Target="{Binding ElementName=FirstNameTextBox}"<br /> /><br /> <TextBox<br />Grid.Row="0" Grid.Column="1"<br /> Name="FirstNameTextBox"<br /> Text="{Binding Path=FirstName}"<br /> /><br /></Grid><br /><Form><br /> <Field For="{Binding Path=FirstName}" /><br /> <Field For="{Binding Path=LastName}" /><br /> <Field For="{Binding Path=EmailAddress}" /><br /></Form><br />
  46. 46. Consistency<br /><TextBlock<br /> Foreground="Red"<br /> Text="Please enter..." /><br /><TextBlock<br /> Foreground="{StaticResourceColor.Bad}"<br /> Text="Please enter..." <br /> /><br />
  47. 47. Style Catalogues<br /><TextBox Width="300" .../><br /><TextBox Width="156" .../><br /><TextBox Width="215" .../><br /><TextBox Style="{StaticResourceTextBox.Big}" /><br /><TextBox Style="{StaticResourceTextBox.Small}" /><br /><TextBox Style="{StaticResourceTextBox.Medium}" /><br />
  48. 48. Behaviours<br />Consider this:<br />Developers don't write code; they build tools for designers<br />
  49. 49. Performance Considerations<br />
  50. 50. Performance Considerations<br />Retained scene vs. Immediate Mode<br />Virtualization (data and UI)<br />Memory leaks<br />Third party components<br />Performance test from day 1<br />
  51. 51. Q&A<br />Links:<br />http://www.codeplex.com/CompositeWPF<br />http://magellan.codeplex.com<br />http://www.galasoft.ch/mvvm/getstarted/<br />http://caliburn.codeplex.com<br />Paul Stovell<br />paul@paulstovell.com<br />www.paulstovell.com<br />

×