Download presentation
Presentation is loading. Please wait.
1
Patterns
2
What is a Pattern? "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“ (Christopher Alexander)
3
Pattern Definition “A pattern for software architecture describes a particular recurring design problem that arises in specific design contexts, and presents well- proven generic scheme for its solution. The solution scheme is specified by describing its constituent components, their responsibilities and relationships, and the ways in which they collaborate.”
4
Why use Patterns? A pattern addresses a recurring design problem that arises in specific design situations, and presents a solution to it. Patterns document existing, well-proven design experience. Patterns identify and specify abstractions that are above the level of single classes and instances, or of components. Patterns provide a common vocabulary and understanding for design principles Patterns are a means of documenting software architectures.
5
Why use Patterns? Patterns support the construction of software with defined properties. Patterns help you build complex and heterogeneous software architectures. Patterns help you to manage software complexity.
6
What Makes a Pattern? Context : Design situation giving rise to a design problem Problem : Set of forces repeatedly arising in the context Solution : Configuration to balance the forces Structure with components and relationships Run time behaviour
7
Patterns Categories Architectural Patterns
Expresses a fundamental structural organization schema for software systems. It provides a set of predefined subsystems, specifies their responsibilities, and provides the rules and guidelines for organizing the relationship between them. Example :MVC pattern for interactive software systems
8
Model View Controller Pattern
Context : Developing software with a human – computer interface Problem : Two forces Easy to modify the user interface Core functionality of the software should not be affected Solution : Structure - Receive I/p via mouse buttons, or keyboard Run time behaviour – Events are translated into requests and sent to the model or view
9
Patterns Categories Design Patterns
Provides a scheme for refining the subsystems or of a software system, or the relationships between them. It describes the common recurring structure of communicating components that solves a general design problem within a particular context. Eg: Publisher – Subscriber Pattern Smaller in scale than architectural patterns & tend to be independent
10
Publisher – Subscriber Pattern
Context : A component uses data or information provided by another component Problem : Change in internal components lead to inconsistencies between them. Forces associated are Info provider should not depend on details of the collaborators. Components depend on info provider are not known priori Solution : Implement change propagation mechanism betn info provider – subject and dependent component – observer Observer register /unregister dynamically Push-model, pull-model or a combination of both
11
Patterns Categories Idioms
Low – level pattern specific to a programming language. Describes how to implement particular aspects of components or relationship between them using the features of the given language. Eg: Counted Body
12
Counted Body Context : The interface of the class is separated from its implementation. A handle class -> class interface Body ->Implementation Problem : Assignment in C++ - Member by Member whereas in Smalltalk, it is rebinding. Set of forces to balance Copying is expensive with storage & time But use pointers & references need to be cleaned Sharing of bodies -> wrong semantically updating Solution : A reference count is added to the body class
13
Relationship Between Patterns
A pattern solves a particular problem, but its application may raise new problem which requires some other pattern s help. Refinement of Model View Controller pattern Seeks Observer pattern when model updates Supports the implementation Document View variant of the MVC Eg An Interactive text editor Selecting the right pattern in a given situation Transparent peer-to-peer interprocess communication Forwarder Receiver Pattern with Proxy Combination – Compose complex design structure
14
Pattern Description Template
Name : The name & a short summary of pattern Also Known As : Other names for the pattern Example : A real world example Symbol -> Beginning []end Context Problem Solution Structure :A detailed spec of structural aspects Dynamics: Typical run time behavior Implementation: Guidelines for implementing Examples Resolved Variants Known Uses Consequences : Benefits & Liabilities See Also
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.