Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building State of the art presentation tiers Nauzad Kapadia

Similar presentations


Presentation on theme: "Building State of the art presentation tiers Nauzad Kapadia"— Presentation transcript:

1 Building State of the art presentation tiers Nauzad Kapadia nauzadk@quartzsystems.com

2 Key Objectives Importance of the presentation tier and overview of technologies available Guidelines for designing presentation tiers Discuss the issues commonly faced in presentation tiers Present solutions and workarounds

3 Importance of the presentation tier

4 ASP.Net Silverlight Flash Windows Presentation Foundation Windows Forms Flex HTML 5 User Experience Silverlight OOB XBAP

5 General guidelines Separate the UI from the logic that drives the UI Do not design complex and overloaded UIs Do not ever block the UI thread Test the presentation tier

6 The MVVM Pattern View Contains the User Interface The Face of the application View Model Drives the View Provides all the data required by the view, in the format that it requires Model Provides the business logic for the PT Acts like a gateway between the PT and the middle -tier

7 Testability Problem –What is the easiest way to test my presentation tiers Solution –Use the MVVM pattern

8 Separation of concerns and reuse Problem –Want to free the UI from the logic that drives it –Re-use of presentation tiers in different environments with minimal effort Solution –Use the MVVM pattern.

9 DEMO Application design using the MVVM pattern

10 Caching - guidelines Carefully choose the right data for caching Chose the appropriate location for the cache Design a cache refresh and updation strategy

11 Caching Problems –How do I synchronize my cache across multiple servers across a farm –How do I cache data on the client in a non- obstructive manner Solutions –Use Velocity® for web-farm level cachine –Use the IsolatedStorage area on the client- side

12 DEMO Using the Isolated Storage Area

13 Validation guidelines Design a non-intrusive, but fool-proof validation strategy Display error messages prominently Do not perform excessive validations

14 Validation Problem –How do I provide some generic rules which can be re-used in multiple places –How do I centralize all my validation logic for a single entity –How do I control when the validation rules are fired Solutions –Use Validation Rules for generic validations –Use IDataErrorInfo for centralizing validation logic –Use ErrorProvider pattern for more control

15 DEMO IDataErrorInfo and ErrorProviders

16 Exception Management guidelines Design a centralized exception management strategy Log Exceptions Display appropriate and generic error messages Do not use exceptions to control program flow Do not re-throw the same exception

17 // BAD WAY //... search for Product if ( dr.Read() ==0 ) // no record found, ask to create{ //this is an example of throwing an unnecessary exception because //nothing has gone wrong and it is a perfectly acceptable situation throw( new Exception(“Product Not found")); } // GOOD WAY //... search for Product if ( dr.Read() ==0 ){ // no record found, ask to create return false; }

18 Navigation guidelines Allow navigation within your application to happen in a easy consistent manner Consider access rules and security trimming while implementing navigation Navigation elements should reflect the state of the application.

19 Navigation Problem –How do I keep my UI controls and navigation elements in sync with the current state of my application Solution –Use the Controller Pattern –Use the Commanding Pattern

20 DEMO The Commanding Pattern

21 Localization guidelines Build localization support right in the beginning Design the UI keeping in mind that string sizes may vary significantly for the same content in different languages

22 Localization Problem –How do I localize my UI in multiple languages –How do I facilitate the addition of “language packs” to my application Solutions –Use.resx files

23 DEMO Localizing applications

24 Composite application guidelines Decide how modules will fit into the overall application Decide how to discover modules Decide on a DI container Determine the communication strategy between modules

25 Composite Applications Problem –How do I build a modular application –How do I discover modules at runtime –How do I enable loosely coupled communication between modules Solutions –Use PRISM –Use a Dependency Injection framework like MEF or Unity

26 DEMO DI using MEF

27 UI Responsiveness guidelines Do not block the UI thread ever Show the progress of a long running operation Consider giving the user the chance to cancel a long running operation Reduce the start-up time of modules Pre-initialize commonly-used modules and views

28 UI Responsiveness Problem –How do I ensure that my UI is not blocked during a long running operation –How do I allow the user the cancel a long-running operation –How do I improve the responsive-ness of my UI Solution –Use background threads for long running operations –Use Task Parallel Library or ThreadPools –Use Caching

29 Resources Software Application Developers http://msdn.microsoft.com/ Infrastructure Professionals http://technet.microsoft.com/ msdnindia technetindia @msdnindia @technetindia

30 © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "Building State of the art presentation tiers Nauzad Kapadia"

Similar presentations


Ads by Google