Design Patterns-1 7 Hours.

Slides:



Advertisements
Similar presentations
DISTRIBUTED COMPUTING PARADIGMS
Advertisements

MicroKernel Pattern Presented by Sahibzada Sami ud din Kashif Khurshid.
Feng Zhiyong Tianjin University Apr 9, 2005
9.5 Software Architecture
Broker Pattern Pattern-Oriented Software Architecture (POSA 1)
SS ZG653Second Semester Topic Architectural Patterns – Review of Patterns.
© 2005 Prentice Hall7-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Chapter 19 Binding Protocol Addresses (ARP) Chapter 20 IP Datagrams and Datagram Forwarding.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Communicating over the Network Network Fundamentals – Chapter 2.
1 Architectural Patterns Yasser Ganji Saffar
Client/Server Software Architectures Yonglei Tao.
Design Patterns.
An Introduction to Software Architecture
9.4 Software Architecture
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 07. Review Architectural Representation – Using UML – Using ADL.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
RELATIONAL FAULT TOLERANT INTERFACE TO HETEROGENEOUS DISTRIBUTED DATABASES Prof. Osama Abulnaja Afraa Khalifah
Architectures of distributed systems Fundamental Models
Patterns and Reuse. Patterns Reuse of Analysis and Design.
Processes Introduction to Operating Systems: Module 3.
Unit 2 Architectural Styles and Case Studies | Website for Students | VTU NOTES | QUESTION PAPERS | NEWS | RESULTS 1.
Hwajung Lee.  Interprocess Communication (IPC) is at the heart of distributed computing.  Processes and Threads  Process is the execution of a program.
1 CMPT 275 High Level Design Phase Modularization.
University of Toronto at Scarborough © Kersti Wain-Bantin CSCC40 system architecture 1 after designing to meet functional requirements, design the system.
Patterns Roberto Damiani Mendes. Roteiro Definition; Definition; Architecture Patterns; Architecture Patterns; Design Patterns; Design Patterns; GRASP.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
High degree of user interaction Interactive Systems: Model View Controller Presentation-abstraction-control.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Pertemuan 09 Architectural Patterns Mata kuliah: T0144 – Advanced Topics in Software Engineering Tahun: 2010.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
1 Distributed Systems Architectures Distributed object architectures Reference: ©Ian Sommerville 2000 Software Engineering, 6th edition.
OSI Model OSI MODEL. Communication Architecture Strategy for connecting host computers and other communicating equipment. Defines necessary elements for.
Software Design Refinement Using Design Patterns
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
Introduction to Design Patterns
Design Patterns.
Observer Design Pattern
CORBA Alegria Baquero.
Software Engineering Architectural Design Chapter 6 Dr.Doaa Sami
Software Design and Architecture
Distribution and components
Software Quality Engineering
CHAPTER 3 Architectures for Distributed Systems
Course contents Basic concepts Fundamental architectural styles
File Transfer and access
#01 Client/Server Computing
The Object Oriented Approach to Design
Ch > 28.4.
Programming Models for Distributed Application
Service-centric Software Engineering
Introduction to Design Patterns Part 1
CORBA Alegria Baquero.
Patterns.
Software Architecture
Design and Implementation
Architectures of distributed systems Fundamental Models
Architectures of distributed systems Fundamental Models
An Introduction to Software Architecture
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
OBJECT ARCHITECTURE DESIGN
Architectures of distributed systems
Ch 17 - Binding Protocol Addresses
Design Yaodong Bi.
Architectures of distributed systems Fundamental Models
#01 Client/Server Computing
Message Passing Systems
Presentation transcript:

Design Patterns-1 7 Hours

Agenda What is a pattern and what makes a pattern? Pattern categories Relationships between patterns Pattern description Communication Patterns Forwarder-Receiver Client-Dispatcher-Server Publisher-Subscriber.

What is a Pattern? When experts work on a given problem, they recall a similar problem they have already solved and reuse that solution in present context. They tend to map it to a Problem-solution pairs. Abstracting problem-solution pair and taking out common factors leads to patterns. Patterns expresses relation between a context, a problem and a solution. Problem-solution pair holds true in the field of software architecture and software engineering.

Example: Model-View- Controller Consider this pattern when developing human-computer interface. User interfaces are prone to changes and they should not be tightly bound to core models. To avoid these issues, divide the application into three areas: Model, View and Controller.

Properties of pattern It addresses recurring design problems. It documents existing, well- proven design experiences. It identifies and specifies abstractions that are above the levels of single class. Provide common vocabulary and understanding for design principles. Document software architecture. Construction of software with defined properties. Helps in building complex and heterogenous architectures. Helps in managing software complexity.

What makes a pattern? Three-part schema Context: a situation giving rise to a problem. Problem: the recurring problem arising in that context. Solution: a proven resolution of the problem.

Context: Describes the situation where problem occurs. It can be general (developing software with a human- computer interface) Or it can be specific (implementing change propagation mechanism of the model-view-controller triad). Specifying the correct context is difficult (practically impossible to determine all situations).

Problem: Describes the problem which arises repeatedly in the given context. It is completed by a set of forces: Requirements that the solution must fulfil. Constraints that must be considered. Desirable properties that the solution must have. Example: MVC enforces 2 rules: Easy to modify UI Core should not be affected.

Solution Solution part shows show to solve the recurring problem (how to balance the forces) Two aspects of the solution: Spatial configuration of elements (Divide the application into 3 areas: Processing, output and input) Run-time behaviour (Controller receives events as input, events are translated to service requests, which are sent to model or view)

Pattern Categories Patterns can be grouped into three categories: Architectural patterns Design patterns Idioms

Architectural Patterns Expresses fundamental structural organization schema, provides set of predefined subsystems, responsibilities, relationships and rules. Example: Model-View-Controller pattern.

Design Patterns Subsystems of the architecture, usually consists of several smaller architectural units. Design patterns provides a scheme for refining subsystems, relationships between them. It describes commonly-recurring structure of component that solves a general design problem. Example: Publisher-Subscriber problem.

Publisher-Subscriber Problem

Idioms Idiom is a low-level pattern specific to a programming language. Describes how to implement aspects of components, relationships using the feature of given language. Example: Counted Body

Relationship between Patterns A pattern may solve a given problem, but the solution may create another problem. Each pattern depends on the smaller patterns it contains and on the larger patterns in which it is contained. Patterns can combine in more complex structures (if it has more forces) Example: Transparent peer-to-peer inter-process communication Efficient, no delay Should not affect others clients or servers Communicate as if they were in the same process

2 Patterns are used to satisfy the given forces Forwarder-Receiver Pattern Proxy pattern

Pattern Description Patterns should be described uniformly, helps in comparison when we are looking for alternative solutions. Add more description to the basic structure(context-problem- solution). Name: Name and short summary Also know as: Other names for the pattern Example: A real world example demonstrating the existence of the problem and the need for the pattern. Context: Situation

Problem: Problem that the pattern addresses. Solution: Fundamental solution. Structure: Structural aspects of the pattern. Dynamics: Run time behaviour. Implementation: Guidelines for implementation. Example resolved: Imp. aspects for resolving the example that are not yet covered in the solution. Variants: Description of variants. Known uses: Examples of the use of pattern. Consequences: Benefits and liabilities See Also: References to patterns that solve similar problems.

Communication Most of the devices in communication use network of computers and are distributed. These systems should collaborate and needs a means of communication. Communication mechanism is usually hardcoded in these devices. To free the devices from this strong coupling, we use abstract this layer. Two patterns to address this issue. The Forwarder-Receiver design pattern The Client-Dispatcher-Server design pattern To keep components in consistent state, we use The Publisher-Subscriber pattern

Forwarder-Receiver Provides transparent IPC for software system with peer-to-peer interaction model. Introduces forwarders and receivers to decouple peers from underlying communication mechanism.

Context: Peer-peer communication Problem: To build a distributed application we make use of common IPC such as TCP/IP, sockets, etc. They introduce dependency in the OS and protocols., restricting portability, avoids heterogeneous network support. Forces to balance: System should allow exchangeability of communication mechanisms. Cooperation of components, sender knows only names of receivers. Communication should not have major impact on performance.

Solution Peers collaborate to solve this problem. It may act as client, server, or both. Underlying IPC mechanism is hidden by encapsulating system- specific-functionality. (mapping names to physical location, channel establishment, etc.) Structure Consists of 3 components: forwarders, receivers and peers. Peers use applications and communicate with other peers (same machine or different machine). It send messages using forwarder and receives using receiver.

Forwarder component sends messages across process boundaries. Provides abstraction of IPC mechanism and includes functionality of marshaling and delivery of messages. It identifies the physical location of recipient using name-to- address mapping. Name of the peer is mentioned in the transmitted message. Types of messages by forwarder: Command messages (ex: change routing tables) Information messages (Contain data) Response messages (ack of the message)

Receiver component provides abstraction similar to forwarder for enabling IPC. Functionality: receive the message and unmarshal it.

Peer uses sendMsg of forwarder, passing message as argument. Forwarder converts it and sends it to receiver (marshal and deliver) When peer wants to receive a msg, it uses receiveMsg, which calls receive (IPC mechanism to receive). receiveMsg calls unmarshal to convert from IPC format to peer understandable format

Dynamics P1 and P2 are two peers who want to communicate. P1 uses a forwarder Forw1 and a receiver Recv1, similarly, P2 uses Forw2 and Recv2. P1 is requesting some service from P2. It requests Forw1 and specifies name of P2. Forw1 determines the physical location and marshals the message. P2 would have requested Recv2 to wait for requests. Recv2 receives the message from Forw1. Recv2 unmarshals and forwards to P2.

P1 calls Recv1 to wait for the response. P2 performs the requested service and sends the result and name of P1 to the Forw2, which marshals and send it P1. Recv1 receives the response from P2, unmarshals it and delivers to P1.

Implementation: Steps Specify a name-to-address mapping. (name space) Specify the message protocols to be used between peers and forwarders. (msg. structure between peer and forwarder) Choose a communication channel. (depends on OS- TCP/IP, sockets) Implement the forwarder. (public interface, marshaling and sending) Implement the receiver. Implement peers of the application. Implement a start-up configuration.

Client-Dispatcher-Server Client-Dispatcher-Server introduces an intermediate layer, the dispatcher. Provides location transparency and hides the details of connection establishment.

Problem: Forces to balance Context: A software system integrating a set of distributed servers (local and global servers). Problem: Forces to balance Use a service independent of location of the service provider. Code used for implementation of core functionality should be separate from code used to establish connection. Solution: Provide a dispatcher component between clients and servers. It implements a name service that allows referring by names instead of physical locations. It is responsible for connection establishment between clients and servers.

Structure:

Static Relationships

Dynamics

Implementation: Steps Separate the applications into clients and servers. Decide which communication facilities are required. Specify the interaction protocols between components. Decide how to name servers. Design and implement the dispatcher. Implement the client and server components.

Variants: Known Uses: Distributed Dispatchers. Client-Dispatcher-Server with communication managed by clients. Client-Dispatcher-Server with heterogeneous communication. Client-Dispatcher-Service. Known Uses: Sun’s Remote Procedure Calls. OMG Corba (Common Object Request Broker Architecture)

Consequences Benefits Liabilities Exchangeability of servers. Location and migration transparency. Re-configuration. Fault tolerance. Lower efficiency through indirection and explicit connection establishment. Sensitivity to change of the dispatcher.

Publisher-Subscriber Also known as: Observer, Dependents. Problem: Forces to balance One or more components must be notified about change in a component. The number and identities of dependents is not known a priori and may change over time. Explicit polling by dependents is not feasible. Publisher and dependents should not be tightly coupled.

Solution: Publisher maintains a registry of currently-subscribed components. When publisher changes state, it sends a notification to all its subscribers. Push model – Publisher sends all the changed data when it notifies subscribers. Pull model – Publisher sends minimal information, subscribers are responsible for retrieving the data.

Variants: Gatekeeper: Distributed systems. Event Channel: Proxy publishers and subscribers.