Ca Gv2 Uxmagic Presentation


Published on

Introduction to Composite Application Guidance

Published in: Design, Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Ca Gv2 Uxmagic Presentation

  1. 1. Composite Application Guidance An Introduction..
  2. 2. Introduction to Composite Application Guidance aka “Prism” Building Silverlight and WPF applications with Composite Applications Guidance and Composite Application Library Don Burnett
  3. 3. Prism is compliant with your development process • design patterns like Model- • Code-Behind minimalist View-View Model and • Modular, Composite Model-View-Presenter Application • Test-Driven Development • Distributed Agile Team (TDD) • Fluent Interfaces • Loosely Coupled • Multi-Targeting Silverlight • Separation of Concerns and WPF (SoC) • Routed Commands & • Interface-based Routed Events Programming • High Performance Dev • Dependency Injection (DI) • Data Binding • Inversion of Control (IoC) Containers
  4. 4. Topics • Targeting Silverlight or WPF – Managing complexity – Best practices for testing and design patterns • Focus around UI concerns – XAML, Code-behinds, Data Binding • Using Prism – Runtime Library + Guidance + Project Linker
  5. 5. Related Technologies • Windows Presentation Foundation (WPF), Silverlight, XAML • Unit Testing (nUnit), TDD • Dependency Injection (DI), Inversion of Control (IoC), Loose coupling • UI Design Patterns (MVC, MVP)
  6. 6. Goals • Appreciate value of C-A-G for Silverlight and WPF • Demonstrate a few key Prism concepts • A little WPF, Silverlight; discuss a couple of Design Patterns / Anti-Patterns
  7. 7. Terminology • Composite Application Guidance for WPF and Silverlight Version 2 • Composite Application Library for WPF and Silverlight  runtime support included – sometimes called “CAL”
  8. 8. Composite Applications Guidance v2 Patterns & Practices Group
  9. 9. • Long development cycles Product Groups • Strategic • Big Teams • Costs • Support Patterns & Practice Group • Rapid cycle times • Small, focused agile teams • Ship tactical solutions now • EntLib, Unity, Arch Guide – Code and Guidance • CAB, Prism v1, Prism v2 • Open Source • Legacy free
  10. 10. Composite Applications Key Concepts
  11. 11. Shell, Regions, Views • Shell is main window for applications • Shell defines (visual) Regions • Regions control where UI will appear -dynamic • Views are displayed within a region • WPF/Silverlight design, code, tooling is complimentary – Composite Application Guidance brings it together
  12. 12. Views and Modules • Modules are DLLs (Projects) • You can decide which modules to load • Modules can be configured to load code, XML, or XAML • Modules can be downloaded – Can write your own rules for loading • Modules have Views (usually)
  13. 13. Events • .NET events are tightly coupled (references in both directions) • WPF events – Loosely coupled and limited to same visual tree • Composite events – Loose coupling; not limited to same visual tree • More: Force to UI thread; event filtering • Events are triggered through commanding.
  14. 14. CAG/Prism Conventions • Bootstrapper • Shell • One module per DLL • M-V-VM pattern
  15. 15. Why Separate UI from Code? • Improves Developer / Designer interaction • Develop in Visual Studio and Design in Expression Blend • Easier Testing- now possible to Unit Test (vs. Integration Test) – Simpler issue of isolation • Reuse opportunity goes way up – Same ViewModel can be reused with UI variations • Better organized code is easier to understand and maintain. SE Principles: SoC, coupling, cohesion, SRP (rendering, mouse & keyboard, disabled, hover)
  16. 16. How to Separate Concerns in UI? • Use Code-Behinds reluctantly + M-V-VM • M-V-VM Model-View-ViewModel Pattern • Abbreviated as M-V-VM, MVVM • Referred to as ViewModel • Presentation Model pattern where View knows about ViewModel • Documentation refers to it as Presentation Model • ViewModel pattern is the more common term.
  17. 17. Advantages Commanding also spans View & ViewModel No UI in VM MVP is a delegation model – MVVM handles this with data binding – way less code in the code-behind Silverlight controls don’t automatically implement Icommand so this is extremely useful.
  18. 18. ViewModel Pattern Load external data from web services, etc. View Data Binding ViewModel Your Code Model Supported by WPF / SL C-A-G provides an Automapper to smartly map your data to the view.
  19. 19. Code-Behind Pattern (Old Way) Load external data from web services, etc. View Observable Collections/Code Model Code Behind for each Control Supported by WPF / SL
  20. 20. Prism Still In the Wild • You build it • Microsoft Patterns and Practice does not ship a binary at this time. • No Prism-specific templates for Visual Studio (YET!) • Cannot unload a Module.. Choose what you load WISELY..
  21. 21. When to go Composite? • You are designing “complex” WPF or Silverlight applications, helpful in Line of Business situations. • You are building an application that presents information from multiple sources through an integrated user interface. • You are developing, testing, and deploying modules independently of other modules.
  22. 22. When to go Composite? • Your application will add more views and more functionality over the coming years, or… • You must be able to change the app quickly and safely to meet emergent business requirements, or… • Your application is being developed by multiple collaborating teams; or… • Your application targets both WPF and Silverlight, and you want to maximize code sharing between platforms.
  23. 23. When to NOT go Composite? • Your applications do not require any of the above scenarios. • Your application consists of a few simple screens. • You are prototyping. • Your developers do not have the time to learn about Composite Application Guidance.
  24. 24. Advantages • SoC + SRP + reducing plumbing code + Unit Tests is the best way to handle complexity and enable ability to respond rapidly to changing requirements. • M-V-VM  best design/development pattern to support application development in Silverlight and WPF.
  25. 25. Official Site -- or --
  26. 26. Watch these spaces • “Contrib” site @ • Channel 9 for tutorial videos – • Infragistics control adapters for Prism @ – Region Adaptors for Prism
  27. 27. Prism v2 References • D=fa07e1ce-ca3f-4b9b-a21b- e3fa10d013dd&DisplayLang=en • release-composite-application-guidance-for-wpf-and- silverlight-v2-0-prism.aspx • released-composite-guidance-for-silverlight-lob.aspx • application-guidance-for-wpf-and-silverlight-v20-prism/
  28. 28. Other Resources • Josh Smith on MVVM with WPF: us/magazine/dd419663.aspx • Brian Noyes on Understanding Routed Events and Routed Commands in WPF: us/magazine/cc785480.aspx • WPF Commanding Overview: • Martin Fowler’s description of Presentation Model pattern: • XAML Guidelines for Creating a Composite UI:
  29. 29. Thanks for Attending.. Building Silverlight and WPF applications with Composite Applications Guidance and Composite Application Library Don Burnett
  30. 30. Composite Application Guidance An Introduction..