Your SlideShare is downloading. ×
0
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Designingapplswithnet
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Designingapplswithnet

749

Published on

This presentation will help you to understand the best design methodologies that are used in the industry

This presentation will help you to understand the best design methodologies that are used in the industry

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

  • Be the first to like this

No Downloads
Views
Total Views
749
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
30
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. .NET Solutions DSK Chakravarthy http://dskc.blogspot.com
  • 2. Who am I? <ul><li>Certified by Microsoft </li></ul><ul><li>Having hands on all phases of SDLC </li></ul><ul><li>Conducted sessions for major players of the industry… like … Infosys, Accenture, Wipro, etc., </li></ul><ul><li>Been a consultant for Project management </li></ul>
  • 3. Agenda for the Day <ul><li>Application Architecture </li></ul><ul><ul><li>Design Pattern </li></ul></ul><ul><ul><li>Services and Integration </li></ul></ul><ul><li>Component Types </li></ul><ul><li>Recommendations for Application design </li></ul><ul><li>Layers </li></ul><ul><ul><li>Business </li></ul></ul><ul><ul><li>Data </li></ul></ul>
  • 4. Pre Lunch Session <ul><li>Over view of Distributed Application Design </li></ul><ul><li>Services and Service Integration “?s” </li></ul><ul><li>General Design Recommendations for Applications and services </li></ul><ul><li>Designing Presentation Layers </li></ul><ul><ul><li>UI Components </li></ul></ul><ul><ul><li>Process Components </li></ul></ul><ul><li>Prerequisites </li></ul><ul><li>Architect (s) / Tech Export (s) </li></ul><ul><li>Team Leader (s) </li></ul><ul><li>Sr. Programmers with C# in depth </li></ul>
  • 5. Best architecture design <ul><li>Users </li></ul><ul><li>Presentation </li></ul><ul><li>Business Logic </li></ul><ul><li>Data Tier </li></ul>
  • 6. Design Patterns <ul><li>It describes all the necessary elements and characteristics of the solution in generic language and it forms the basis for any implementation </li></ul><ul><li>We use the design patterns for </li></ul><ul><ul><li>To minimize design flaws </li></ul></ul><ul><ul><li>Performance enhancement </li></ul></ul><ul><ul><li>Adaptability </li></ul></ul><ul><ul><li>Scalability </li></ul></ul>Design Patterns should not be confused as a ready made detail of a particular implementation, it’s a template There are almost 26 patterns, which fall in 3 categories…
  • 7. <ul><li>Creational : Deals with the problems of the Object construction . Provides flexi approach for 4 Ws (Who, What, Where & When) </li></ul><ul><li>Structural : Governs how the objects and classes work together </li></ul><ul><li>Behavioral : Supervise messages sent between the objects </li></ul>Design Patterns Note : The PatternForm is invented by Mr. Christopher Alexander, and he calls them as just “ Patterns ”, but not as “ Design Patterns ” In the current world you’ve around 62 kinds of patterns in practice
  • 8. Design Patterns Full List <ul><li>AbstractFactoryPattern aka KitPattern </li></ul><ul><li>AbstractClientPattern </li></ul><ul><li>ActionPattern aka CommandPattern, TransactionPattern </li></ul><ul><li>ActiveObjectPattern </li></ul><ul><li>AdapterPattern aka WrapperPattern </li></ul><ul><li>AbstractServerPattern </li></ul><ul><li>ApplicationControllerPattern </li></ul><ul><li>WrapperPattern aka AdapterPattern </li></ul><ul><li>BalkingPattern </li></ul><ul><li>BindingProperties </li></ul><ul><li>BridgePattern aka HandleBodyPattern </li></ul><ul><li>BuilderPattern </li></ul><ul><li>CaretakerPattern </li></ul><ul><li>ChainOfResponsibilityPattern </li></ul><ul><li>CommandPattern aka ActionPattern, TransactionPattern </li></ul><ul><li>CompositePattern </li></ul><ul><li>CursorPattern aka IteratorPattern </li></ul><ul><li>DataBusPattern </li></ul><ul><li>DecoratorPattern aka WrapperPattern </li></ul><ul><li>Dependents Pattern aka ObserverPattern, PublishSubscribePattern, PubSubPattern </li></ul><ul><li>DisableJobRequestsWhileRunningJob </li></ul>
  • 9. Design Patterns Full List <ul><li>DoubleCheckedLocking </li></ul><ul><li>DynamicUserInterfacePattern </li></ul><ul><li>FacadePattern </li></ul><ul><li>FacetPattern </li></ul><ul><li>FactoryMethodPattern aka VirtualConstructorPattern </li></ul><ul><li>FlyweightPattern </li></ul><ul><li>FrontControllerPattern </li></ul><ul><li>GuardedSuspension </li></ul><ul><li>HandleBodyPattern aka BridgePattern </li></ul><ul><li>HierarchicalVisitorPattern </li></ul><ul><li>InterpreterPattern </li></ul><ul><li>IteratorPattern aka CursorPattern </li></ul><ul><li>KitPattern aka AbstractFactoryPattern </li></ul><ul><li>LazyInstantiationPattern </li></ul><ul><li>MediatorPattern </li></ul><ul><li>MementoPattern aka Token Pattern </li></ul><ul><li>MockObjectPattern aka Service Stub Pattern </li></ul><ul><li>MonostatePattern </li></ul><ul><li>NullObjectPattern </li></ul><ul><li>ObserverPattern aka DependentsPattern, PublishSubscribePattern, PubSubPattern </li></ul><ul><li>PolicyPattern aka StrategyPattern </li></ul><ul><li>PrototypePattern </li></ul><ul><li>ProxyPattern aka SurrogatePattern </li></ul><ul><li>PublishSubscribePattern aka DependentsPattern, ObserverPattern, PubSubPattern </li></ul><ul><li>PubSubPattern aka DependentsPattern, ObserverPattern, PublishSubscribePattern </li></ul><ul><li>ReadWriteLock </li></ul>
  • 10. Design Patterns Full List <ul><li>ScheduledTask </li></ul><ul><li>SchedulerPattern </li></ul><ul><li>SeparatedInterface Pattern aka InterfaceSegregationPrinciple </li></ul><ul><li>ServiceStubPattern aka MockObjectPattern </li></ul><ul><li>SingletonPattern </li></ul><ul><li>StatePattern aka StatesPattern </li></ul><ul><li>StatesPattern aka StatePattern </li></ul><ul><li>StaticUserInterfacePattern </li></ul><ul><li>StrategyPattern aka PolicyPattern </li></ul><ul><li>SurrogatePattern aka ProxyPattern </li></ul><ul><li>TemplateMethodPattern </li></ul><ul><li>TokenPattern aka MementoPattern </li></ul><ul><li>TransactionPattern aka ActionPattern, CommandPattern </li></ul><ul><li>VirtualConstructorPattern aka FactoryMethodPattern </li></ul><ul><li>VisitorPattern </li></ul>
  • 11. Design Patterns an Example Problem: You are building a Quote Application, which contains a class that is responsible for managing all the quotes in the system. It is important that all quotes interact with one and only one instance of this class. How do you structure your design so that only one instance of this class is accessible with in the application? Solution: A simple solution to this problem is to create a QuoteManager class with a private constructor so that no other class can instantiate it. This class contains a static instance of QuoteManager that is returned with a static method named GetInstance () . Can you design the code for the same?
  • 12. Design Patterns an Example public class QuoteManger { // NOTE: For single threaded application only private static QuoteManagaer _Instance = null; private QuoteManager () {} private static QuoteManager GetInstance () { if (_Instance==null) { _Instance = new QuoteManager (); } return _Instance; } } NOTE: This kind of Pattern is said as “Singleton Pattern”
  • 13. <ul><li>We are focusing on distributed applications and WebServices that may need to provide integration capabilities for multiple data sources & services, and they may require a user interface for one (or) multiple devices </li></ul>Our Focus – Distributed Application Design <ul><li>Designing a distributed application involves </li></ul><ul><li>Making decisions about it’s logical and physical architecture issues </li></ul><ul><li>Sound knowledge of the technologies and infrastructure used to implement the functionality </li></ul><ul><li>Should be very much aware of the business process that the application will perform </li></ul><ul><ul><li>Functional Requirements </li></ul></ul><ul><ul><li>Levels of scalability, availability, security </li></ul></ul><ul><ul><li>Maintainability required i.e., Non-Functional, operational, requirements </li></ul></ul>
  • 14. Services n Integration Specialisation means not doing the Extraordinary things, but doing Ordinary things Extraordinarily well... So, What are you doing?
  • 15. <ul><li>As iNet and related technologies grow, and the large organizations seek to integrate their systems across the companies boundaries, a service-based approach to design solutions has evolved </li></ul>Services n Integration ?s  What are services? # C onceptually, they are similar to the Traditional Components  How are they? # They encapsulate their own data and remember, they are not a part of your application, rather they are used by your application  What is the difficulty with services? # They might have built on different platforms by different teams on different schedules and may be maintained & Updated independently Therefore, it’s critical to implement communication between them
  • 16.  How do I resolve? # You can implement communication between them by using message-based technologies # You can implement message communication by i) Explicitly – By writing code to send and receive Message Queuing Messages. Ex. MSMQ ii) Implicitly – By using Infrastructure components that manage communication. Ex. A Web service proxy by VS.NET Services n Integration ?s
  • 17.  How are the services differ from Components? # Services exists in their own trust boundary and manage their own data, out side your application  What is crucial between Services & Application integration? # Establishing a secure, authenticated connection  What should I be aware, while using a service? # The internal implementation is irrelevant to your design # But need to know the business functionality that the service provides # Also the details of the contract you must adhere to in order to communicate with it such as i) Communication Format ii) Data Schema iii) Authentication Mechanism etc., Services n Integration ?s
  • 18.  What a service contain? # The same kind of components that any traditional application do # You can categorise them as i) Logic Components : That orchestrate the tasks they do ii) Business Components : That implement the actual BL iii) Data Access Components : that access the service’s data store iv) Interfaces : That expose the functionality  What happens when I integrate a service? # Your application will also call other services through “ Service agents ”, which communicate with service on behalf of the calling client application Services n Integration ?s
  • 19. A small scenario A Retail application <ul><li>This application has an order UI to place orders, this could be either web or non-web </li></ul><ul><li>This application uses an external Credit Card authentication service to validate the customer’s credit card details and authorise the sale </li></ul><ul><li>A courier service is used to arrange the delivery of goods </li></ul><ul><li>Can you give me a Sequence diagram????? </li></ul>
  • 20. A small scenario A Retail application Sequence Diagram
  • 21. Components and Tiers in Application Imagination is more important than knowledge
  • 22. Distributed design Distributed Application Design means, “You should divide your application into components providing PBD ( Presentation , Business and Data ) Services”. While doing the same follow the below rules. <ul><li>Form the Functional Layers : Group the Components that perform similar types of functions into layer </li></ul><ul><li>Prepare the Communication Channel : Components in the same layer communicate via Agents, but the communication with “ABOVE “ or “ BELOW” a certain layer use the services </li></ul>
  • 23. Points to Note <ul><li>Layer : Combination of similar component types </li></ul><ul><li>Tier : Physical distribution pattern </li></ul># Conceptually, the services can be seen as components of overall solution. # Internally, each service is made up of software components, just like any other application and these components are logically grouped into Presentation / Business Logic /Data Services # While designing the application, follow the below steps 1) ( Can you ) Draw a block diagram for the ( previous ) scenario ! % & $ # ? 2) Explain the bits & pieces of each block as internal elements 3) Finally, prepare a simplified view of any application and it’s layers 4) But remember that, each service encapsulates its own data and manages atomic transactions on it’s own For now, sketch a component design for the previous scenario
  • 24. Component design A Retail application Component Diagram You might design the one like this . . .
  • 25. Simplified View Here comes the simplified view of any general application and it’s layers
  • 26. A Detailed View The previous scenario for the detailed design would look like . . . .
  • 27. General Design Recommendations for Applications and Services <ul><li>Identify the components that are required and not required </li></ul><ul><li>Design the components as consistent as possible </li></ul><ul><li>Understand “How components communicate?” </li></ul><ul><li>Maintain the “Data Format” consistent for Exchange </li></ul><ul><li>Follow the code policies </li></ul><ul><li>Enforce strict Layering System </li></ul>
  • 28. Tea Break
  • 29. Components - In detail Knowing the path to failure is as important as Knowing the path to success
  • 30. Component Types Note : The term component is used in the sense of a piece or part of the overall solution. This includes compiled software components such as Microsoft .NET assemblies, and other software artifacts such as Web pages and Microsoft BizTalk Server schedules
  • 31. Components In detail <ul><li>User Interface (UI) Components : Use them to render and format data for users and to Acquire and Validate data coming in from them </li></ul><ul><li>User Process Components : To help the user interactions synchronize with the UI Components , it is a best practise to drive the process using separate User Process Components </li></ul><ul><li>Business Workflows :These components are used to perform the business process . During the transaction, these process could take an inderminate amount of time to complete, so the required tasks and the data required to perform them would have to be managed </li></ul><ul><li>Business Components : Regardless of whether a business process consists of a single step or an orchestrated workflow, your application will probably require components that implement business rules and perform business tasks </li></ul><ul><li>Service Agents : Any business component that needs to use functionality provided by an External service, they many need to provide some code to manage the semantics of communicating with that particular service </li></ul><ul><li>Service Interfaces : These expose business logic as service that support the communication contracts ( message-based communication, formats, protocols, security etc.,) These are sometimes referred to as Business facades </li></ul><ul><li>Data Access Logic Components : It makes sense to abstract the logic necessary to access data in a separate layer of DAL Components </li></ul><ul><li>Business Entity Components : These help Data to traverse between components, they are used internally in every application “Data structures such as DataSets, DataReaders, XML Streams.. </li></ul><ul><li>Components for Security, Operational Management and Communication : The main purpose of these components to perform </li></ul><ul><ul><ul><li>Exception management </li></ul></ul></ul><ul><ul><ul><li>Authorize users to perform certain tasks </li></ul></ul></ul><ul><ul><ul><li>To communicate with other services and applications </li></ul></ul></ul>
  • 32. Designing Presentation Layers
  • 33. <ul><li>Windows Desktop User Interfaces </li></ul><ul><li>Internet Browser User Interfaces </li></ul><ul><li>Mobile Device User Interfaces </li></ul><ul><ul><li>Web User Interface </li></ul></ul><ul><ul><li>Smart Device User Interface </li></ul></ul><ul><li>Document-based User Interfaces </li></ul><ul><ul><li>.NET to Office Developers </li></ul></ul><ul><ul><li>Office ‘n’ .NET Interoperability </li></ul></ul>UI Components & Types
  • 34. Designing UI Components ShowProducts() { // Code to // get product // data } Controller When a user interacts with a user interface element, an event is raised that calls code in a controller function, which inturn calls business components, data access logic components (or) user process components to implement the desired action and retrieve any necessary data..
  • 35. A Small Scenario You are designing a web-based quote application containing a great deal of business and presentation logic, which, in turn, depends on numerous platform software components to provide a suitable execution environment. How do you organise your system at a high level to be flexible, loosely coupled, and yet highly cohesive? Can you rearrange wrf to Layers? CustomerManagement Inventory Management CustomerWebPages Utility Quote WebPages Quote Management Price Engine ADO.NET QuoteDataAccess
  • 36. Solution Scenario Can you rearrange any? The solution could be as.. .. .. .. CustomerManagement Inventory Management CustomerWebPages Utility Quote WebPages Quote Management Price Engine ADO.NET QuoteDataAccess Quote Presentation Layer Quote Business Layer Quote Data Access Layer
  • 37. UI Components <ul><li>UI Components by nature </li></ul><ul><ul><li>Don’t initiate or participate in transaction </li></ul></ul><ul><ul><li>Have ref to user process component </li></ul></ul><ul><ul><li>Encapsulate both view functionality and a controller </li></ul></ul><ul><li>While accepting input from user UI Components should </li></ul><ul><ul><li>Acquire proper data from users and assist them via different techniques </li></ul></ul><ul><ul><li>Capture the events and call controller functions </li></ul></ul><ul><ul><li>Initiate an action on the current user process o changing data of the current user process </li></ul></ul><ul><ul><li>Restrict the types of input a user can enter </li></ul></ul><ul><ul><li>Perform Data Validation </li></ul></ul><ul><ul><li>Perform simple mapping to values needed by the underlying components to do their work. Ex: You may capture “Product Name”, convert to “ID” </li></ul></ul><ul><ul><li>Internet user gestures to call a controller functions, such as dragNdrop or button clicks </li></ul></ul><ul><ul><li>Use a utility component for Caching and Paging </li></ul></ul>
  • 38. Windows Desktop – UIs Recommendations When creating a Windows Forms-based application, consider the following recommendations <ul><li>Rely on data binding to keep data synchronized across multiple forms that are open simultaneously </li></ul><ul><li>Try avoiding hard-coding relationships between forms to make the elements more reusable </li></ul><ul><li>Implement error handlers (or) exception handlers </li></ul><ul><li>Validate user input, this validation should occur at the stages of every process that allow point-in-time validations </li></ul><ul><li>For the custom controls, expose only the public properties and methods that are actually needed </li></ul><ul><li>Implement controller functions as separate functions. Do not implement controller functionality directly in control events handlers (Look at the example from the book) </li></ul>
  • 39. iNET Browser UIs Recommendations When you are implementing an application and publish a Web page-based user interface for a browser, consider the following design recommendations for ASP.NET user interfaces <ul><li>Implement a custom error page, and a global exception handler in Global.asax </li></ul><ul><li>Use ASP.NET rich validation controls (or) if the user process has a Validate control function, call it before transitioning to other pages to perform point-in-time validation </li></ul><ul><li>If you are using WebUserControls, expose only the public properties and methods that are actually needed </li></ul><ul><li>Use ViewState to store page specific state </li></ul><ul><li>Controller functions should invoke the actions on a user process components to guide the user through the current task rather than redirecting the user to the page directly </li></ul><ul><li>Implement controller functions as separate functions. Do not implement controller functionality directly in control events handlers (Look at the example from the book) </li></ul>
  • 40. Process Components <ul><li>A standardized specification that improves the integrity, confidentiality and security of Services </li></ul><ul><li>Bill Gates </li></ul><ul><li>LasVegas, Niveda, Jan 5 th 2005 </li></ul>
  • 41. These help the user interactions synchronize with the UI Components , it is a best practise to drive the process using separate User Process Components User process components are typically implemented as .NET classes that expose methods that can be called by user interfaces. Each method encapsulates the logic necessary to perform a specific action in the UP The user interfaces creates instances of the user process component and uses it to transition through the steps of process You should design them with globalization in mind to allow for localization to be implemented in the User Interface Note : User process components co-ordinate the display of user interface elements Task for You : Can you design common ProcessComponent for the previous Retail application ? UP Components
  • 42. UP Components Example namespace PurchaseUserProcess{ public class PurchaseUserProcess{ public PurchaseUserProcess(){ userActivityID= System.Guid.NewGuid(); } private int intCustomerID; private DataSet dsOrderData; private DataSet dsPaymentData; private Guid userActivityID; public bool webUI; public void ShowOrder() { if(webUI){ System.Web.HttpContext.Current.Response.Redirect(&quot;http://www.myserver.com/orderDetails.aspx&quot;); } else{ OrderDetails = new OrderDetailsForm(); OrderDetails.Show(); } } public void EnterPaymentDetails() { // code to display the Payment details page or window goes here } public void ShowConfirmation() { // code to place the order goes here } public void Finish() { // code to go back to the main page or window goes here } public void SaveToDataBase() { // code to save order and payment info in the private variables to a database } public void ResumeCheckOut(System.Guid ProcessID) { // code to reload the process state from the Database } public void Validate() { // code to make sure the process instance variables have the right information for the current step } } }
  • 43. UP Components Advantages <ul><li>Separating the user interaction functionality into user interface and user process components provides the following advantages </li></ul><ul><li>Long-running user interactions state is more easily persisted, allowing a user interaction to be abandoned and resumed, possibly even using a different user interface </li></ul><ul><li>The same user process can be reused by multiple user interfaces </li></ul>
  • 44. UP Components <ul><li>Guidelines for separating a UserProcess from UserInterface </li></ul><ul><li>Draw Sequence Diagrams – helps you to identify the business process that the UserInterface process will help to accomplish </li></ul><ul><li>Identify the data needed by the business process </li></ul><ul><li>Identify additional state you will need to maintain </li></ul><ul><li>Design the visual flow of the UserProcess </li></ul><ul><li>UserProcess Component Interface Design </li></ul>
  • 45. UP Design <ul><li>UP “Actions”(1) : these typically trigger a change in the state of UserProcess. One should try to encapsulate calls to business components to these action methods (6) </li></ul><ul><li>State Access Methods(2) : to acess the business-specific state by using GET & SET properties to expose one value to the business process deals with (5) </li></ul><ul><li>State Change Events(3) : Fired during the business-related state of the UserProcess changes </li></ul>4) Control functions that let you start, pause, restart, and cancel a particular user Process(4) : Control methods could load required reference data for the UI from data access logic components (7) or delegate this work to the UI Component that needs the data
  • 46.  

×