Docsity

GoV Patterns Design-Patterns in Software Engineering-Lecture 9 Slides-Computer Engineering, Slides of Software Engineering

Partial preview of the text

Download GoV Patterns Design-Patterns in Software Engineering-Lecture 9 Slides-Computer Engineering and more Slides Software Engineering in PDF only on Docsity!

Patterns in Software Engineering Lecturer: Raman Ramsin^ Lecture 9Lecture 9^ GoV Patterns: Design

Department of Computer Engineering

1

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 GoV Design Patterns: CategoriesGoV^ Design Patterns: Categories ย„ Structural Decomposition^

^ Support a suitable decomposition of subsystems and complex components into ^ Support^ a suitable decomposition of subsystems and complex components intocooperating parts.^ ^ Whole-Part ย„ Organization of Work ย„ Organization^ of Work^ ^ Define how components collaborate together to solve a complex problem.^ ^ Master-Slave^ Access Control ย„ Access^ Control^ ^ Guard and control access to services or components.^ ^ Proxy ย„ Management^ ^ Handle homogenous collections of objects, services and components in their entirety.^ ^ Command Processor

andView Handler ย„^ Communication^ ^ Help to organize communication between components.^ ^ Forwarder-Receiver

Client-Dispatcher-Server

andPublisher-Subscriber Department of Computer Engineering

2

Sharif University of Technology

^ Forwarder-Receiver

,Client-Dispatcher-Server, and

Publisher-Subscriber

Patterns in Software Engineering โ€“ Lecture 9 Design: Organization of WorkDesign:^ Organization of Work ย„ Master-Slave:

supports fault tolerance, parallel computationpp^

, p^

p

and computational accuracy. A

master component:

^ distributes work to identical

slave^ components, and

^ computes a final result from the results these slaves return. ย„ The^ Chain of Responsibility

,^ Command^

and^ Mediator

patterns also belong to this category.Department of Computer Engineering

4

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Organization of Work: Master

-Slave โ€“ Structure

Organization of Work: Master Slave

Structure

ย„^ Amaster^ component

p distributes work to identicalslave

components;

^ computes a final result from the results these slaves return.The master component provides a service that can be solved by applyingย„ The^ master component provides a service that can be solved by applyingthe 'divide and conquer' principle. Department of Computer Engineering

5

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Design: Access ControlDesign:^ Access Control ย„ Proxy:^ makes the clients of a component communicate with arepresentative rather than to the component itself. ย„ The^ Facade

and^ Iterator

patterns also belong to this tcategory. Department of Computer Engineering

7

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Design: ManagementDesign:^ Management ย„ Command Processor:

separates the request for a service from itsp^

q

execution. A command processor component:^

^ manages requests as separate objects,h d l^ th^

ti^ f th^

t^ d

^ schedules the execution of the requests, and ^ provides additional services such as the storing of request objects for later undo. ย„ View Handler:

helps to manage views in a software system. A view

handler component:^

^ allows clients to open, manipulate and dispose of views,^ ^ coordinates dependencies between views, and^ ^ organizes the update of the views.g^

p

ย„^ The^ Memento

pattern also belongs to this category.

Department of Computer Engineering

8

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Management: Command Processor

-^ Dynamics

Management:

Command Processor

Dynamics

Department of Computer Engineering

10

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Management: View HandlerManagement:

View Handler

ย„^ A^ view handler

component

ย„^ A^ view handler

component

manages all views that the software system provides, allows clients to open^ manipulate and dispose of views

and

^ allows clients to open, manipulate and dispose of views, and ^ coordinates dependencies between views and organizes their update. ย„ Specific views, together with functionality for their presentation andcontrol^ are encapsulated within separate

view components

one for

control, are encapsulated within separate

view components - one for

each kind of view. ย„ Suppliers^ provide views with the data they must present.Department of Computer Engineering

11

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Management: View Handler

-^ Dynamics (1)

Management:

View Handler

Dynamics (1)

ย„^ Scenario I:

The view handler creates a new view. Scenario I: The^ view handler creates a new view. Department of Computer Engineering

13

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Management: View Handler

-^ Dynamics (2)

Management:

View Handler

Dynamics (2)

ย„^ Scenario II:

The view handler organizes the tiling of views. Scenario II: The^ view handler organizes the tiling of views. Department of Computer Engineering

14

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Communication: Forwarder

-Receiver

Communication: Forwarder Receiver^ ย„^ Peer^ components:

ibl^ f^ li^ i^

k

^ are responsible for application tasks, ^ know the names of the remote peers with which they need to communicate, and ^ use aforwarder

to send messages to other peers and a

receiver^ to receive

g^ p

messages from other peers. ย„ Forwarder^ components:

send messages across process boundaries, provide a general interface for sending messages, marshal and deliver messages to remote receivers, and

g^

^ map names to physical addresses. ย„ Receiver^ components: ^ are responsible for receiving messages, ^ provide a general interface for receiving messages, and ^ receive and unmarshal messages from remote forwardersDepartment of Computer Engineering

16

Sharif University of Technology

^ receive^ and unmarshal messages from remote forwarders.

Patterns in Software Engineering โ€“ Lecture 9 Communication: Forwarder

-Receiver^

  • Structure

Communication: Forwarder Receiver

Structure

Department of Computer Engineering

17

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Communication: Client

-Dispatcher-Server

Communication: Client Dispatcher Server^ ย„^ Provides adispatcher

component to act as an intermediate layer betweenp p^

y

clients^ andservers. The dispatcher^ ^ implements a name service that allows clients to refer to servers by namesinstead of physical locations, thus providing location transparency, andinstead of physical locations, thus providing location transparency, and^ ^ is responsible for establishing the communication channel between a client anda server. ย„ Before sending a request to a server, the client

asks the dispatcher for a

communication channel.^ ^ The client uses this channel to communicate with the server.A^ id^

t^ f^ ti^ t

li^ t ย„^ A^ server provides a set of operations to clients.^ ^ It either registers itself or is registered with the dispatcher by its name andaddress.Department of Computer Engineering

19

Sharif University of Technology

Patterns in Software Engineering โ€“ Lecture 9 Communication: Client-Dispatcher-Server โ€“ Structure

p Department of Computer Engineering

20

Sharif University of Technology