Design Patterns in Web Programming Nathan Wallace March 2000 Introduction About Me Why listen to me? What am I talking about? Disclaimer Design Patterns.

Slides:



Advertisements
Similar presentations
17 HTML, Scripting, and Interactivity Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and.
Advertisements

Chapter 11 user support. Issues –different types of support at different times –implementation and presentation both important –all need careful design.
ARCH-05 Application Prophecy UML 101 Peter Varhol Principal Product Manager.
Object-Oriented Design Patterns Composite Singleton State Observer … Autumn 2012UCN Technology: IT/Computer Science1.
Requirements Engineering n Elicit requirements from customer  Information and control needs, product function and behavior, overall product performance,
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Introduction To System Analysis and Design
Observer Pattern Fall 2005 OOPD John Anthony. What is a Pattern? “Each pattern describes a problem which occurs over and over again in our environment,
Component-Level Design
Design and Programming Patterns Associated with Java Networking by Margaret Toews cs843, Spring 2003.
Dept. of Computer Engineering, Amirkabir University of Tech. 1 Design Patterns Dr. Noorhosseini Introduction.
Architecture, Deployment Diagrams, Web Modeling Elizabeth Bigelow CS-15499C October 6, 2000.
Supplement 02CASE Tools1 Supplement 02 - Case Tools And Franchise Colleges By MANSHA NAWAZ.
Use Case Analysis – continued
Chapter 22 Object-Oriented Design
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 16 Slide 1 User interface design.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Domain Modeling (with Objects). Motivation Programming classes teach – What an object is – How to create objects What is missing – Finding/determining.
UNIT-V The MVC architecture and Struts Framework.
Introduction to software design patterns For CSE 3902 By: Matt Boggus.
Web Design and Patterns CMPT 281. Outline Motivation: customer-centred design Web design introduction Design patterns.
1 Introduction to Web Development. Web Basics The Web consists of computers on the Internet connected to each other in a specific way Used in all levels.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 13 Slide 1 Application architectures.
Introduction To System Analysis and design
Design Patterns Discussion of pages: xi-11 Sections: Preface, Forward, Chapter
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
©2007 · Georges Merx and Ronald J. NormanSlide 1 Chapter 11 Reality Check: Java Programming in the Real World.
Requirements Analysis
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
An Introduction to Software Architecture
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
Introduction to Design Patterns (1). Definition: “ In software engineering, a design pattern is a general reusable solution to a commonly occurring problem.
Comp2110 Software Design lecture 13Detailed Design (1)  detailed design contrasted with high level design  introducing the Observer Design Pattern 
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
101 User Interface Patterns and its applications Tonya Groover Department of Computer Science.
Interface analysis – User analysis, task analysis and modeling, analysis of display content and work environment Interface design steps Design issues.
1 Another group of Patterns Architectural Patterns.
Introduction To System Analysis and Design
A Reference Model for Event Patterns Christian Silberbauer
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
1 What is OO Design? OO Design is a process of invention, where developers create the abstractions necessary to meet the system’s requirements OO Design.
ECE450S – Software Engineering II
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Design Pattern Catalog - Page L3-1 PS95&96-MEF-L10-1 Dr. M.E. Fayad Creationa.
Security Patterns Template and Tutorial - Darrell M. Kienzle, Ph.D., Matthew C. Elder, Ph.D., David S. Tyree, James Edwards-Hewitt Presented by Dan Frohlich.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Design Patterns Introduction
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
SEA Side – Extreme Programming 1 SEA Side Software Engineering Annotations Architectural Patterns Professor Sara Stoecklin Director of Software Engineering-
21/1/ Analysis - Model of real-world situation - What ? System Design - Overall architecture (sub-systems) Object Design - Refinement of Design.
From Use Cases to Implementation 1. Structural and Behavioral Aspects of Collaborations  Two aspects of Collaborations Structural – specifies the static.
CSCI 383 Object-Oriented Programming & Design Lecture 7 Martin van Bommel.
1 Good Object-Oriented Design Dr. Radu Marinescu Lecture 4 Introduction to Design Patterns.
1 Management Information Systems M Agung Ali Fikri, SE. MM.
From Use Cases to Implementation 1. Mapping Requirements Directly to Design and Code  For many, if not most, of our requirements it is relatively easy.
XML and Distributed Applications By Quddus Chong Presentation for CS551 – Fall 2001.
GRASP – Designing Objects with Responsibilities
Design Patterns: MORE Examples
Software Design Patterns
A Brief Introduction to Design Patterns
Section 17.1 Section 17.2 Add an audio file using HTML
Web Programming Language
Patterns.
An Introduction to Software Architecture
Informatics 122 Software Design II
From Use Cases to Implementation
Presentation transcript:

Design Patterns in Web Programming Nathan Wallace March 2000 Introduction About Me Why listen to me? What am I talking about? Disclaimer Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Why listen to me? Accidentally in the wrong room Strong OO Background IBM Visual Age Synop Symphony Toolkit “Beautiful model” Introduction About Me Why listen to me? What am I talking about? Disclaimer Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

What am I talking about? Design Patterns Common Web Problems for Solving Design Patterns in a Web Context A Web Design Pattern Language Web Programming Design Pattern Space Example Patterns Future Work Introduction About Me Why listen to me? What am I talking about? Disclaimer Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Disclaimer Two moments of clarity Good design patterns require: Introduction About Me Why listen to me? What am I talking about? Disclaimer Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1. Years of experience 2.Collaboration 3.Continuing Refinement This is the first step

Design Patterns According to Christopher Alexander: “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice” Introduction Design Patterns What are they? Why are they important? Where are they used? Why web patterns? How do we find patterns? Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Design Patterns Formal description of problem and solution Should also explain Why? Introduction Design Patterns What are they? Why are they important? Where are they used? Why web patterns? How do we find patterns? Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Why are they important? Captures expert knowledge Simple format that novices can use Helps us avoid “reinventing the wheel” Best solutions are often non-obvious Helps us learn about system structure Influences future design We have a means for comparing solutions Introduction Design Patterns What are they? Why are they important? Where are they used? Why web patterns? How do we find patterns? Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Where are they used? Architecture Story telling Object Oriented Programming Introduction Design Patterns What are they? Why are they important? Where are they used? Why web patterns? How do we find patterns? Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Why web patterns? Web applications are now common Web programming is maturing We have no common language Unique programming and UI problems Rapid development is more important now Introduction Design Patterns What are they? Why are they important? Where are they used? Why web patterns? How do we find patterns? Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

How do we find patterns? Sense of déjà vu in design We naturally reuse good code and structure Draw on experience and expertise Decide what we want them to be Introduction Design Patterns What are they? Why are they important? Where are they used? Why web patterns? How do we find patterns? Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Building a web pattern language I felt I knew what the patterns should be Build a high level catalog of problems What aspects should the language capture? Introduction Design Patterns What are they? Why are they important? Where are they used? Why web patterns? How do we find patterns? Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Finding web programming patterns On-going process Identify generic problems to solve Consider well known standard sites Introduction Design Patterns What are they? Why are they important? Where are they used? Why web patterns? How do we find patterns? Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Admit our infancy Web programming is still very young The web itself is continually evolving Good design patterns take years to refine Standards are beginning to emerge A good time to start developing patterns Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Application Levels Web applications are built over many levels: Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.User Interface 2.Human Computer Interaction 3.Information Design 4.Scripting 5.Code Libraries 6.Database Queries 7.Database Design

Application Levels It’s nice to abstract the levels In reality problems exist across levels: Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.Optimizing database queries 2.Form processing So, our language must work across levels

Form Processing All web applications use forms The basic method is always the same: Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.Display a form to the user 2.Verify the data with error handling 3.Perform the required action on the data

Form Processing cont… Ways to implement the basic flow: Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.Single page, self-referring form 2.Multi-page form

Form Processing cont… Methods of error handling: Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.Display all input, highlighting errors 2.Only show invalid fields for re-entry 3.Report error, rely on back button 4.Report error, link to input page

Form Processing cont… Frontend application levels Requires interaction with the user Flow and information design are vital Should result in calls to the code library Forms are decoupled from the backend Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Navigation Sites need a consistent look and feel Users need context and location Should be decoupled from content Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Navigation cont… Standard types of navigation: Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.Single level hierarchy 2.Static multi-level hierarchy 3.Dynamic multi-level hierarchy

Navigation cont… Frontend application levels Should be decoupled like MVC model May require knowledge of context / location Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Database Operations Fundamental problem in web applications Techniques: Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.Specific Functions 2.Database Abstraction layer

Database Operations cont… Many database operations work on rows Reuse code for new and editing records Dreaming of high level programming Different types of database interaction: Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.Logging 2.User Interactive 3.Under the hood 4.Content

Database Operations cont… Wrappers live in the database layers Higher level dreaming requires more levels Backend encapsulating queries into objects Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Authentication Fundamental to tracking, sessions and users Formal definition of types: Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.None – no tracking at all 2.Session – anonymous tracking 3.Visitor – multi-visit anonymous tracking 4.User – known information

Authentication cont… Consider these levels as the same problem Generic system to work across levels Every request has an authentication level We can dream of building automated tools Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Authentication cont… User level authentication is at all levels Other authentication is backend only Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Error Handling Graceful degradation for users is vital Report errors to administrators Display appropriate error messages For example, database availability Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Error Handling cont… Errors must be caught from any level Messages are displayed to the user Stretches across all application levels Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

E-commerce Builds on other solutions Decoupled from forms and authentication Application levels depend on independence Introduction Design Patterns Common Problems Admit our infancy Application levels Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions

Choosing a Level of Abstraction Patterns are supposed to be generic Abstract from problems to find patterns The key is choosing a level of abstraction Web programming is a specific problem Hence we cannot abstract too far Introduction Design Patterns Common Problems Web Context Level of Abstraction Application Levels Pattern Language Web Pattern Space Example Patterns Future Work Questions

Choosing a Level of Abstraction cont… Object Oriented Level of Abstraction Our abstraction must describe web problems Are they still patterns? Introduction Design Patterns Common Problems Web Context Level of Abstraction Application Levels Pattern Language Web Pattern Space Example Patterns Future Work Questions

Application Levels Specific problem for the web context OO Patterns don’t know about app levels Could divide patterns by level Introduction Design Patterns Common Problems Web Context Level of Abstraction Application Levels Pattern Language Web Pattern Space Example Patterns Future Work Questions 1.HTML Patterns 2.OO Patterns for backend 3.User Interaction Patterns

Application Levels in Context We want web programming patterns Ignore levels when choosing patterns Create a multi-level pattern language Introduction Design Patterns Common Problems Web Context Level of Abstraction Application Levels Pattern Language Web Pattern Space Example Patterns Future Work Questions

Web Programming Pattern Language Build on existing pattern patterns A meta-pattern Modifying the language for OO in: Design Patterns: Elements of Reusable Object-Oriented Software Gamma et al. Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Basic Requirements of a Pattern Language Short, descriptive name Problem description Present a solution Highlight consequences Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Pattern Name and Classification Succinct description Becomes part of design vocabulary Classifications group similar patterns Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Intent Short statement, including: Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions 1.What does the design pattern do? 2.What is its rationale and intent? 3.What particular design issue or problem does it address?

Also Known As Other well-known names for the pattern Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Motivation An example describing the function and use of the pattern. Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Applicability Where should we use this pattern? How can we recognize these situations? Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Sequence of Events Web programming specific field Execution sequence for the pattern High level steps, not implementation level For example: Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions 1.HTTP Request Sequence 2.User Interaction Sequence

Participants Other patterns participating in this pattern The responsibilities of those patterns Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Collaborations How the participants collaborate Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Consequences How does the pattern support its objectives? What are the consequences of its use? What are the trade offs? Example, database utilization Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Implementation Notes on implementation: Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions 1.Pitfalls 2.Hints 3.Techniques 4.Language Specific Issues 5.Environment Specific Issues

Sample Code Code fragments for common languages Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Related Patterns What design patterns are closely related? What are the important differences? What patterns should this one be used with? Introduction Design Patterns Common Problems Web Context Pattern Language Basis Requirements Definition Web Pattern Space Example Patterns Future Work Questions

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Introduction Space Example Patterns Future Work Questions 1.Organize patterns 2.Understand our catalogue 3.Quickly find related patterns Web Programming Design Pattern Space Helps us: Preliminary definition only

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Introduction Space Example Patterns Future Work Questions Preliminary Web Pattern Space Behavioral describe an application task Structural describe an event sequence

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Example Patterns - Filter Classification Behavioral Intent Provide a mechanism for conditionally executing code at the start or end of each page request.

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Example Patterns – Filter cont… Motivation Having the ability to conditionally run functions as part of a web page is a very powerful tool for web programmers. It gives us the flexibility to add and configure logging functions, authentication checks and so on. Filters control the registration and execution of these functions.

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Example Patterns – Filter cont… Applicability Check notes for details

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Example Patterns – Filter cont… Sequence of Events Client requests page Register filters Check conditions on all post_auth filters and run if met Run page script Check conditions on all trace filters and run if met

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Example Patterns – Filter cont… Participants None

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Example Patterns – Filter cont… Collaborations The developer may register and run a number of post_auth and / or trace filters. The return values of these filter functions influence the continuing execution of the filters. See the Implementation section below for more information.

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Example Patterns – Filter cont… Consequences Configuring conditional code execution is easy. Adding a new logging function or authentication filter is just a filter registration function call away. Be careful of filter side effects. Filters can stop the rest of a page from completing execution or stop other filters from running. You need to pay special attention to the order that filters are registered and their likely return values.

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Example Patterns – Filter cont… Implementation See notes Sample Code See notes

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Behavioral Patterns Data Entry Data Edit Data Maintenance Authentication Error Handling

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Filter Behavioral Patterns Structural Patterns Future Work Questions Structural Patterns Self-referring page Multi-page form

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions Future Work Improve Pattern Language Work on Web Pattern Space Discuss and build the Catalogue

Introduction Design Patterns Common Problems Web Context Pattern Language Web Pattern Space Example Patterns Future Work Questions