Training Class on Prism, MVVM, and MEF 


Programming Microsoft Prism, MVVM, and MEF

Day 1 Morning:   Introduction

Lecture: Introduction to Prism. Problems addressed by Prism. Goals and non-goals of the Prism framework. Advantages and disadvantages of loose coupling. Common and uncommon usage scenarios. Types of applications that Prism does well, types that it does not. Basic architectural layout of the Prism system, components of a Prism application. Definition of basic terms. Analogies to CAB/SCSF and OLE. Concepts of targeting both WPF and Silverlight.

Lab: Installation of Prism SDK. Exploration of its parts.

Day 1 Afternoon:  Prism Application Walkthrough

Lecture:  Walkthrough of Hello, World sample Prism application, in WPF and Silverlight. Examination of tools for creating your own Prism application, guidance packages written by your instructor.  Examination of the Bootstrap class. Examination of UnityContainer and its Resolve method, differences between WPF and Silverlight.  Examination of MEF injection container, differences from and similarities to Unity

Lab: Generate Hello, World application using instructor's templates. Make changes, observe results.

Day 2 Morning:  Services and Modules

Lecture:  Concept of a module, implementing the IModule interface. Using guidance package written by your instructor to add a module to your project. Injection of container reference into modules. Different ways of specifying the module list: hard-wired, .config file, directory sweep, web service. Preparing a module for remote downloading. Concept of a service: separation of interface and implementation. Creating a service. Registering a service locally and globally. Fetching and using services.

Lab: Work with sample application manipulating services and modules.

Day 2 Afternoon: User Interface Composition with Regions and Views Using Model-View-ViewModel Pattern

Lecture: Need for loose coupling in the user interface. Definition of a region. Examination of the Region Manager service. Adding a region to your application. Examination of the IRegion interface. Creating a custom region. Fetching a region and showing a view in it.  Concept of a view and view model. Creating and implementing a new view/view-model class. Using pull-based and push-based composition for associating view with regions.

Lab: Work with sample application showing regions and views

Day 3 Morning: Shared User Interface Extension and Commands

Lecture: Need to integrate with WPF Command mechanism to respond to items from the user interface, such as button clicks. Examination of the ICommand interface.  Declaring and creating a Command object. Examination of the CompositeCommand and DelegateCommand classes. Connecting to the Command object via single and multicast delegates. Local versus Global commands. Using Command object to allow modules to show menus and toolbars and ribbons. Example integrating Commands and Regions.

Lab:  Work with sample application integrating events and regions.

Day 3 Afternoon:  Event System and Testing of Prism Applications

Lecture: Problems of loosely-coupled notification. Introduction to the Event Broker service. Characteristics of a Prism event. Static and dynamic subscriptions to an event. Specifying the thread on which an event notification is received. Static and dynamic firing of an event. Specifying the scope of a fired event. Filtering on event parameters.

 Need for automated, continuous testing of applications to meet today’s software standard of care. Discussion of different types of testing – lowest-level unit testing, highest-level acceptance testing, and types in between. Examination of unit testing strategies for modules and services in Prism. Use of mock objects for injection into unit testing. Testing strategies for the model-view-viewmodel and model-view-presenter stacks. Separation of activities that require human intervention for testing; need for and strategies for minimizing this set. Measuring and dealing with code coverage of testing in Prism. Designing Prism apps for testability.

Lab: Work with sample application using automated testing and loosely coupled events