DaveAndAl.net Do Application Design Patterns Make Sense in ASP.NET? Alex Homer You may like to write these down now...

Slides:



Advertisements
Similar presentations
Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
Advertisements

DESIGN PATTERNS OZGUR RAHMI DONMEZ.
Object-Oriented Analysis and Design
Design Patterns Yes, they are important Robert Cotton April 23, 2009.
2 Object-Oriented Analysis and Design with the Unified Process Objectives  Explain how statecharts can be used to describe system behaviors  Use statecharts.
Introduction To System Analysis and Design
05/26/2004www.indyjug.net1 Indy Java User’s Group June Knowledge Services, Inc.
Design Patterns CS is not simply about programming
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Spring 2010CS 2251 Design Patterns. Spring 2010CS 2252 What is a Design Pattern? "a general reusable solution to a commonly occurring problem in software.
Software Engineering I Object-Oriented Design Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science.
Adapters Presented By Zachary Dea. Definition A pattern found in class diagrams in which you are able to reuse an ‘adaptee’ class by providing a class,
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Chapter 26 Applying Gang of Four Design Patterns 1CS6359 Fall 2012 John Cole.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Builder A Creational Design Pattern A Presentation by Alex Bluhm And.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse 2.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Systems Analysis and Design in a Changing World, Fifth Edition
Software Waterfall Life Cycle Requirements Construction Design Testing Delivery and Installation Operations and Maintenance Concept Exploration Prototype.
ASP.NET  ASP.NET is a web development platform, which provides a programming model, a comprehensive software infrastructure and various services required.
MVC and MVP. References enter.html enter.html
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
Todd Snyder Development Team Lead Infragistics Experience Design Group.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
Introduction to J2EE Architecture Portions by Kunal Mehta.
CSSE 374: Introduction to Gang of Four Design Patterns
12 Systems Analysis and Design in a Changing World, Fifth Edition.
ISP666 MVC & Design Patterns. Outline Review Event Programming Model Model-View-Controller Revisit Simple Calculator Break Design Patterns Exercise.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Patterns in programming 1. What are patterns? “A design pattern is a general, reusable solution to a commonly occurring problem in software. A design.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Architecture.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
Introduction To OOP 1.0 Fundamentals Of Java Programming Language 2.0 Exception Handling 3.0 Classes, Inheritance And Polymorphism © 2011 | PN AZRINA.
Unit 4 Object-Oriented Design Patterns NameStudent Number CAI XIANGHT082182A KYAW THU LINHT082238Y LI PENGFEIHT082220L NAUNG NAUNG LATTHT082195L PLATHOTTAM.
Patterns in programming1. 2 What are patterns? Answers to common design problems. A language used by developers –To discuss answers to design problems.
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
05/26/2004www.indyjug.net1 Indy Java User’s Group May Knowledge Services, Inc.
Model View Controller MVC Web Software Architecture.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
12 Chapter 12: Advanced Topics in Object-Oriented Design Systems Analysis and Design in a Changing World, 3 rd Edition.
Java EE Patterns Dan Bugariu.  What is Java EE ?  What is a Pattern ?
Concordia University Department of Computer Science and Software Engineering Click to edit Master title style ADVANCED PROGRAMMING PRACTICES Model View.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
Advanced Object-oriented Design Patterns Creational Design Patterns.
Architecture, Design Patterns and Faithful Implementation David Woollard University of Southern California Software Architecture Group NASA Jet Propulsion.
Seung Ha.  Façade is generally one side of the exterior of a building, especially the front.  Meaning “frontage” or “face”  In software architecture,
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Software Design Refinement Using Design Patterns
The Object-Oriented Thought Process Chapter 15
MPCS – Advanced java Programming
Design Patterns Introduction
Instructor: Dr. Hany H. Ammar
Advanced Programming Behnam Hatami Fall 2017.
Frameworks And Patterns
Lecture 1: Multi-tier Architecture Overview
DESIGN PATTERNS : Introduction
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
Presentation transcript:

DaveAndAl.net Do Application Design Patterns Make Sense in ASP.NET? Alex Homer You may like to write these down now

DaveAndAl.net Agenda What are Design Patterns? Basic Design Patterns for ASP.NET Basic Pattern Support within ASP.NET Controller Patterns for ASP.NET Advanced Patterns for ASP.NET Conclusion and Summary

DaveAndAl.net Design Patterns are Scary...!

DaveAndAl.net You Use Patterns Every Day... try { something } catch (SqlException qx) { handle SQL error } catch (SecurityException sx) { handle security violation } catch (Exception ex) { handle all other exceptions } finally { clean up resources } Using xr As XmlReader = XmlReader.Create("file.xml")... read some XML... End Using Structured Exception Handling Factory Lifetime

DaveAndAl.net What are Design Patterns? Informal Design Patterns Code constructs, best practice, well- structured, common sense, the accepted approach, evolved over time Formal Design Patterns Documented as "Context", "Problem", "Solution", and a UML diagram Have specific aims Solve specific issues

DaveAndAl.net Why Do We Need Design Patterns? Engineering disciplines require patterns Structural Engineering Electronic Engineering... even Social Engineering! Creating software is also Engineering Structural design and architecture Componentization and interconnections User interface design and implementation Deployment, testing, and management

DaveAndAl.net Formal Design Patterns "Fundamental to any science or engineering discipline is a common vocabulary for expressing its concepts, and a language for relating them together." "... a body of literature to help software developers resolve recurring problems encountered throughout all of software development." "... a shared language for communicating insight and experience about these problems and their solutions." from

DaveAndAl.net The Gang of Four (GOF) Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides "Design Patterns: Elements of Reusable Object-Oriented Software" (1995) The Hillside Group

DaveAndAl.net Microsoft.NET Design Patterns "Enterprise Solution Patterns Using Microsoft.NET" From the patterns and practices (p&p) Group Printed book (ISBN: ) PDF Download 1C38E-ABFC-484F-A076-CF99B

DaveAndAl.net.NET Design Pattern Frameworks "data & object factory" Design Pattern Framework Ingenious MVC for.NET 2.0 Web and WinForms Microsoft "patterns & practices" Group CAB and ObjectBuilder Enterprise Library Software Factories (Smart Client, Mobile, Web Service)

DaveAndAl.net Pattern Types and Families These are just a few of the common ones... PatternShare.org lists more than 250 !

DaveAndAl.net Common Patterns in ASP.NET Model-View-Controller (MVC) Model-View-Presenter (MVP) Use Case Controller Command Publish-Subscribe / Observer Plug-in / Module / Intercepting Filter Service Agent / Proxy / Broker Provider / Adapter Factory / Builder / Injection Singleton Repository Presentation Logic Host or Behavioral Creational Structural Persistence

DaveAndAl.net Agenda What are Design Patterns? Basic Design Patterns for ASP.NET Basic Pattern Support within ASP.NET Controller Patterns for ASP.NET Advanced Patterns for ASP.NET Conclusion and Summary

DaveAndAl.net MVC & MVP Presentation Patterns Both improve reusability of business logic MVC has dependency between model and view MVP improves testability but adds complexity

DaveAndAl.net Provider / Adapter Patterns Used by ASP.NET itself, and other frameworks such as Enterprise Library Allows behavioral changes without prior knowledge of requirements

DaveAndAl.net Service Agent / Proxy / Broker Removes dependencies between client and service through intermediate brokers Range of different implementations, with or without service agent logic component

DaveAndAl.net Repository Persistence Pattern Virtualizes storage of an entity in a persistent medium, such as a database or as XML Hides storage implementation from the application code

DaveAndAl.net Singleton Creation Pattern Provides for creation of a class for which only a single instance can exist Useful for exposing read-only data Useful for exposing static methods that do not rely on instance data Include private default constructor to prevent client instantiation Provide a static GetInstance method that returns the current instance

DaveAndAl.net Agenda What are Design Patterns? Basic Design Patterns for ASP.NET Basic Pattern Support within ASP.NET Controller Patterns for ASP.NET Advanced Patterns for ASP.NET Conclusion and Summary

DaveAndAl.net Pattern Support within ASP.NET

DaveAndAl.net Pattern Support within ASP.NET

DaveAndAl.net Pattern Support within ASP.NET

DaveAndAl.net Pattern Support within ASP.NET

DaveAndAl.net Pattern Support within ASP.NET

DaveAndAl.net How To... MVP: use ASP.NET code-behind model or extend code file with custom classes Provider: use built-in providers or create custom providers from a base class or interface Repository: typed DataSet, third-party tools (such as CodeSmith), or custom code Adapter: use built-in (such as CSS control adapters) or create custom adapters Service Agent and Proxy: Web References in Visual Studio, maybe wrap in custom class

DaveAndAl.net Basic Patterns in ASP.NET Example

DaveAndAl.net Agenda What are Design Patterns? Basic Design Patterns for ASP.NET Basic Pattern Support within ASP.NET Controller Patterns for ASP.NET Advanced Patterns for ASP.NET Conclusion and Summary

DaveAndAl.net Use Case Controller Coordinates and sequences interaction between the system and the users to carry out a process

DaveAndAl.net Page Controller & Front Controller Select content to display in a page using different partial views, or... Select which page (view) to display

DaveAndAl.net Plug-in/Module/Intercepting Filter Allows the features or behavior of an application to change when it loads separate components that implement extra functionality Plug-ins and Modules may be custom assemblies (modules), or general-purpose software components such as ActiveX controls or Java applets Intercepting Filters reside in an application pipeline, such as the ASP.NET HTTP pipeline Commonly, the components extend the features of the host application

DaveAndAl.net Implementation in ASP.NET HTTP Module performs redirection at front Page Controller selects view elements

DaveAndAl.net How To... Use Case: custom branching code in presenter class - case statements using Server.Transfer, or displaying partial Views as User Controls Page Controller: custom base class for Page that handles Init or Load event to perform common tasks then calls a method in the actual page to create page-specific content Front Controller: an HTTP Module that adds a custom handler to a pipeline event that performs the appropriate Server.Transfer

DaveAndAl.net Page & Front Controller Example

DaveAndAl.net Agenda What are Design Patterns? Basic Design Patterns for ASP.NET Basic Pattern Support within ASP.NET Controller Patterns for ASP.NET Advanced Patterns for ASP.NET Conclusion and Summary

DaveAndAl.net Factory / Builder / Injection Separates the construction of a complex object from its representation Allows use of the same construction process to create different representations In the Factory pattern, the subclasses of the object generator determine the object type In the Builder and Injection patterns, the client passes instructions or hints to the object generator to specify the required object type.

DaveAndAl.net Command Design Pattern Separates command invoker and receiver

DaveAndAl.net Observer and Publish/Subscribe Separates creator and receiver(s) of events

DaveAndAl.net Command-Observer Implementation Client creates and subscribes objects

DaveAndAl.net Command-Observer Implementation Introduces a dependency between Observer and Subject, but removes the requirement for events

DaveAndAl.net Command-Observer Example

DaveAndAl.net Observer and Publish/Subscribe Separates creator and receiver(s) of events

DaveAndAl.net Publish-Subscribe Example

DaveAndAl.net Conclusions - 1 MVP and the various Controller patterns are useful, but firing update events from Model usually is not. Page Controller and Front Controller allow for custom use case behavior by showing different views or activating different presenters. Front Controller can make use of the Intercepting Filter pattern. Repository is useful for virtualization of source data. Singleton is useful for reducing the need for multiple instances. Service Agent and Proxy are ideal for interacting with remote services.

DaveAndAl.net Conclusions - 2 Provider is useful for accessing various types of data sources. Adapter is useful for extending ASP.NET controls. Factory, Builder, Injection, Observer, and Command are probably less useful, more complex, and can be difficult to implement. Event-driven patterns like Publish-Subscribe are generally useful only if all subscribers are instantiated within the page lifetime. The composite Command-Observer event-free approach is useful for removing dependencies between classes.

DaveAndAl.net References Information about Design Patterns: us/dnpag/html/intpatt.asp Contact: Slides & code: Article: