+ All Categories
Home > Documents > View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural...

View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural...

Date post: 15-Oct-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
25
Ashwin J Mathew Spring 2008 School of Information, UC Berkeley View Source: Design Patterns in the Wild Thinking in Patterns
Transcript
Page 1: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

View Source: Design Patterns in the Wild

Thinking in Patterns

Page 2: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Someone invented or developed the code that contains the patterns, but that’s largely irrelevant: It’s that the same solution or style has been used and found habitable... Patterns are discovered because they are well-used, they form a vein that anyone could find.

Richard P. Gabriel“Repetition, Generativity and Patterns”

Page 3: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Components Data

Connectors

Software ArchitectureA software architecture is defined by a configuration of architectural elements - components, connectors, and data - constrained in their relationships in order to achieve a desired set of architectural properties.

Roy Fielding“Architectural Styles and the Design of Network-based Software Architectures”

Page 4: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

WWW

Page 5: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Client ServerHTTP

● Separation of concerns● Encapsulation of functionality● Standardized interface

Page 6: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Facade

Page 7: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

● On the client:– Arbitrary file types

– Unique handler for each file type

● On the server:– Arbitrary protocols

– Unique handler for each protocol

Client

GIF

XML

HTML

PDF

MP3

Server

HTTP 1.0

HTTP 1.1

Proxy Custom

Page 8: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Abstract Factory

Strategy

... or Dependency Injection

Page 9: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

● Handle many types of images● Render each in a similar fashion

Client

GIF

JPEG

PNG

BMP ServerHTTP

Page 10: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Adapter

Page 11: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

● Render different formats in a single page

... <img src='/images/me.gif'/> ...

<embed type='application/x-shockwave-flash' src='/myapp.swf' /> ...

Client

GIF

Flash

HTML

ServerHTTP

Page 12: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Template Method

Visitor

Page 13: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Client ServerHTTPCache Cache

● Caching built into HTTP● Maintain standard interface● Cache is an optional feature

ProxyCache

Page 14: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Intercepting Filter

Proxy

+ Prevalence for storage

Page 15: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Client ServerHTTP

HTML + Javascript

● Execute logic when a HTML page loads

Page 16: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Observer

Page 17: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Client ServerHTTP

● Javascript generated on server● Sent to client for execution

Javascript

Page 18: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Command

Page 19: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

ClientServer

HTTP

● Broadcast to many interested clients

ClientClient

ClientClient

Page 20: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Publish/Subscribe

Page 21: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Other Patterns

● Mediator● Prototype● Map/Reduce● Model-View-Controller● Data Access Object, Active Record

Page 22: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

... and more

Page 23: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

No Silver Bullet

● Essential Complexity

“difficulties inherent in the nature of software”

● Accidental Complexity

“difficulties that attend to its production ... but are not inherent”

Page 24: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Between order and chaos, interesting and unexpected combinations come about and last long enough to have repercussions. Trends can be observed. Patterns emerge.

Richard P. Gabriel and Ron Goldman“Mob Software: The Erotic Life of Code”

Page 25: View Source: Design Patterns in the Wild Thinking in Patterns · 2008. 4. 10. · of architectural elements - components, connectors, and data ... Model-View-Controller ... UC Berkeley

Ashwin J Mathew Spring 2008School of Information, UC Berkeley

Whereas the difference between poor conceptual designs and good ones may lie in the soundness of design method, the difference between good designs and great ones surely does not. Great designs come from great designers. Software construction is a creative process.

Fred Brooks “No Silver Bullet: Essence and Accidents of Software Engineering”


Recommended