Connect with life Nauzad Kapadia Quartz Systems [email protected].
Building State of the art presentation tiers Nauzad Kapadia [email protected].
-
Upload
norman-hubbard -
Category
Documents
-
view
213 -
download
0
Transcript of Building State of the art presentation tiers Nauzad Kapadia [email protected].
Building State of the art presentation tiers
Nauzad [email protected]
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
Importance of the presentation tier
ASP.Net
Silverlight
Flash
Windows Presentation Foundation
Windows Forms
Flex
HTML 5
User Experience
Silverlight OOBXBAP
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
Testability
• Problem–What is the easiest way to test my
presentation tiers
• Solution– Use the MVVM pattern
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.
DEMOApplication design using the MVVM pattern
Caching - guidelines
• Carefully choose the right data for caching
• Chose the appropriate location for the cache
• Design a cache refresh and updation strategy
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
DEMOUsing the Isolated Storage Area
Validation guidelines
• Design a non-intrusive, but fool-proof validation strategy
• Display error messages prominently• Do not perform excessive validations
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
DEMOIDataErrorInfo and ErrorProviders
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
// BAD WAY// ... search for Productif ( 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 situationthrow( new Exception(“Product Not found"));
}
// GOOD WAY// ... search for Productif ( dr.Read() ==0 ){ // no record found, ask to create
return false;}
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.
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
DEMOThe Commanding Pattern
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
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
DEMOLocalizing applications
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
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
DEMODI using MEF
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
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
ResourcesSoftware Application
Developers
http://msdn.microsoft.com/
Infrastructure Professionals
http://technet.microsoft.com/
msdnindia technetindia @msdnindia @technetindia
© 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.