CSC/ECE 517 Fall 2009/wiki2 16 rs: Difference between revisions
(61 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
=Introduction= | =Introduction= | ||
This | This article focuses on the design patterns which are proposed and utilized in the [http://en.wikipedia.org/wiki/Service_oriented_architecture Service Oriented Architecture]. As the SOA provides its services through the protocols and API, this article throws light on the design patterns that specifically provide services through protocols like [http://www.soapatterns.org/canonical_protocol.asp Canonical protocol], [http://www.soapatterns.org/dual_protocols.asp Dual protocols] and [http://www.soapatterns.org/protocol_bridging.asp Protocol Bridging]. In a broader perspective, other design patterns have been explained tersely. In addition to explanation of the SOA design patterns, this compares the SOA design patterns with the traditional design patterns proposed by the ‘Gang of Four’ (Eric Gamma, Richard Helm, Ralph Johnson, and John Vlissides) and comes up with the differences and similarities between them. | ||
=Service Oriented Architecture-An Overview= | =Service Oriented Architecture-An Overview= | ||
Line 12: | Line 12: | ||
==SOA-Definition== | ==SOA-Definition== | ||
A | A [http://en.wikipedia.org/wiki/Service_oriented_architecture Service Oriented Architecture] is an architecture that provides collection of services. These services need to inter-operate with each other to provide the functionality. This architecture requires a loose coupling with operating systems and other technologies that form the basis of the application. The loose coupling between services is required because each interaction has to be independent of the other. The communication between services could be either simple data being passed or it could be either an activity coordinated between distinct entities or services. Some means of interoperability is required to provide the services in larger terms. Instead of defining the [http://en.wikipedia.org/wiki/API API], the SOA implements the interfaces using the protocols and functionality. SOA separates functions into unique entities or services, which are accessed in a network by the users to combine and reuse them to develop the applications. | ||
==Why SOA?== | ==Why SOA?== | ||
Various businesses in the field of [http://en.wikipedia.org/wiki/Information_technology Information Technology] have to justify their projects with a return on their investments. This creates a pressure in Information Technology by making it a demanding field. Information Technology needs to have requirements in a way that it has to responsive and adapt to the changing requirements. | |||
Information Technology companies must also be able to provide the services that are compatible with other services making it interoperable, thus creating dynamic services. Moreover, Information Technology has to face demands to bring new commercial services to a much wider array of customers. Customers may access services through web interfaces, or may be part of a supply chain that needs to decrease the time and cost of manufacturing. | |||
Thus, Information Technology companies are always on the look out for solutions that will help them meet the above demands – without having to spend a lot of money. | Thus, Information Technology companies are always on the look out for solutions that will help them meet the above demands – without having to spend a lot of money. [http://en.wikipedia.org/wiki/Service_oriented_architecture Service Oriented Architecture] offers a solution to satisfy the above needs of the industry | ||
==SOA-Benifits== | ==SOA-Benifits== | ||
In architectural terms, a modern architectural design should be Service Oriented, loosely coupled, driven by events, able to support both integration and assembly, aligned with valuable life cycle support processes, and able to leverage existing infrastructure and applications. | In architectural terms, a modern architectural design should be Service Oriented, loosely coupled, driven by events, able to support both integration and assembly, aligned with valuable life cycle support processes, and able to leverage existing infrastructure and applications. | ||
When it comes to Service Oriented Architecture, it tends to offer a variety of different advantages over more traditional methods of distributing computing. These include | When it comes to Service Oriented Architecture, it tends to offer a variety of different advantages over more traditional methods of distributing computing. These include | ||
i) business services across several platforms | |||
ii) location independence | |||
iii) authentication as well as authorization support on different platforms | |||
iv ) loosely coupled approach, dynamic search and connectivity to other services. | |||
=Design Patterns in SOA= | =Design Patterns in SOA= | ||
A design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be | A [http://en.wikipedia.org/wiki/Design_pattern design pattern] is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be applied in different scenarios. Design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. | ||
Design patterns play a major role in SOA. The implementation and deployment of SOA designs provide different challenges during product development life cycle.Such challenges | Design patterns play a major role in SOA. The implementation and deployment of SOA designs provide different challenges during product development life cycle.Such challenges may make projects to be discontinued. Design patterns help in overcoming these problems by providing a solution to the problems posed. Each SOA design pattern provides a design solution in support of | ||
successfully applying service orientation and establishing a quality | successfully applying service orientation and establishing a quality service-oriented architecture | ||
service-oriented architecture | |||
=Design Patterns proposed = | =Design Patterns proposed = | ||
The proposed Design Patterns for SOA fall in to following categories.They are listed below and corresponding patterns in | The proposed Design Patterns for SOA fall in to following categories. They are listed below and corresponding patterns in | ||
each category are given. | each category are given. Detailed explanation of the design patterns given in the example can be found in the link provided for each category. | ||
[http://www.soapatterns.org/masterlist_c.asp#ch6 Foundational Inventory Patterns] | 1. [http://www.soapatterns.org/masterlist_c.asp#ch6 Foundational Inventory Patterns] | ||
These design patterns focus on providing solutions to the problems like maximizing re-composition and avoiding redundant logic. | |||
Examples include Enterprise Inventory, Domain Inventory, Service Normalization, Logic Centralization, Service Layers Canonical Protocol, Canonical Schema | |||
2. [http://www.soapatterns.org/masterlist_c.asp#ch7 Logical Inventory Layer Patterns] | |||
These design patterns provide the solution to the problem of how can business logic be separated, reused, and governed independently. | |||
Examples for this category are Utility Abstraction, Entity Abstraction, Process Abstraction | |||
3. [http://www.soapatterns.org/masterlist_c.asp#ch8 Inventory Centralization Patterns] | |||
These patterns focus on providing solution for aspect of governing business logic etc | |||
Examples for this category are Process Centralization, Schema Centralization, Policy Centralization, Rules Centralization. | |||
[http://www.soapatterns.org/masterlist_c.asp#ch9 Inventory Implementation Patterns] | 4. [http://www.soapatterns.org/masterlist_c.asp#ch9 Inventory Implementation Patterns] | ||
These patterns help to solve implementation problems like limitations introduced by communication technology. Example like a single protocol may not accommodate all requirements etc | |||
Examples for this category are Dual Protocols, Canonical Resources, State Repository, Stateful Services, Service Grid, Inventory Endpoint, Cross-Domain Utility Layer | |||
5. [http://www.soapatterns.org/masterlist_c.asp#ch10 Inventory Governance Patterns] | |||
The patterns deal with the governance problems caused by service contract within the same service inventory | |||
Examples include Canonical Expression, Metadata Centralization, Canonical Versioning | |||
[http://www.soapatterns.org/masterlist_c.asp# | 6. [http://www.soapatterns.org/masterlist_c.asp#ch11 Foundational Service Patterns] | ||
The patterns proposed in this category focus on solving large business problems without having to build a stand alone solution. | |||
Examples for this category are Functional Decomposition, Service Encapsulation, Agnostic Context, Non-Agnostic Context, Agnostic Capability | |||
7. [http://www.soapatterns.org/masterlist_c.asp#ch12 Service Implementation Patterns] | |||
The patterns in this category focus on improving the realiability and availability of the service | |||
Examples include Service Facade, Redundant Implementation, Service Data Replication, Partial State Deferral, Partial Validation, UI Mediator | |||
[http://www.soapatterns.org/masterlist_c.asp#ch13 Service Security Patterns] | 8. [http://www.soapatterns.org/masterlist_c.asp#ch13 Service Security Patterns] | ||
The patterns proposed in this category deal with the problem of data encapsulation and security aspects. | |||
Examples for this category are Exception Shielding, Message Screening, Trusted Subsystem, Service Perimeter Guard | |||
9. [http://www.soapatterns.org/masterlist_c.asp#ch14 Service Contract Design Patterns] | |||
The patterns proposed in this category focus on providing solution for how to make the service contract suitable for all potential customers,make it aligned with other services etc | |||
Examples for this category are Decoupled Contract, Contract Centralization, Contract De normalization, Concurrent Contracts, Validation Abstraction | |||
[http://www.soapatterns.org/masterlist_c.asp#ch15 Legacy Encapsulation Patterns] | 10. [http://www.soapatterns.org/masterlist_c.asp#ch15 Legacy Encapsulation Patterns] | ||
The patterns proposed deals with the problems in legacy systems like processing of data contained in flat files, redundancy resulting in delivery to multiple channels etc | |||
Examples for this category are Legacy Wrapper, Multi-Channel Endpoint, File Gateway | |||
11. [http://www.soapatterns.org/masterlist_c.asp#ch16 Service Governance Patterns] | |||
These patterns provide solution for problems like updating the customers with changed service so that they are not affected, modifications in service etc | |||
Examples for this category are Compatible Change, Version Identification, Termination Notification, Service Refactoring, Service Decomposition, Proxy Capability, Decomposed Capability, Distributed Capability | |||
[http://www.soapatterns.org/masterlist_c.asp#ch17 Capability Composition Patterns] | 12. [http://www.soapatterns.org/masterlist_c.asp#ch17 Capability Composition Patterns] | ||
The pattern proposed focuses on the problem of How can a service capability solve a problem that requires logic outside of the service boundary and How can the same capability be used to help solve multiple problems? | |||
Examples for this category are Capability Composition, Capability Recomposition | |||
[http://www.soapatterns.org/masterlist_c.asp#ch18 Service Messaging Patterns] | 13. [http://www.soapatterns.org/masterlist_c.asp#ch18 Service Messaging Patterns] | ||
The patterns proposed in this category focus on setting up of message framework for transfer of data. | |||
Examples in this category are Service Messaging, Messaging Metadata, Service Agent, Intermediate Routing, State Messaging, Service Callback, Service Instance Routing, Asynchronous Queuing, Reliable Messaging, Event-Driven Messaging. | |||
14. [http://www.soapatterns.org/masterlist_c.asp#ch19 Composition Implementation Patterns] | |||
The patterns proposed in this category focus on problems during runtime like runtime activities that span multiple services fail, the parent business task is incomplete etc | |||
Examples for this category are Agnostic SubController, Composition Autonomy, Atomic Service Transaction, Compensating ServiceTransaction | |||
15. [http://www.soapatterns.org/masterlist_c.asp#ch20 Service Interaction Security Patterns] | |||
The proposed patterns in this category are focused on security methods like encryption,decryption,authenticating the data,consumer and service | |||
[http://www.soapatterns.org/masterlist_c.asp#ch21 Transformation Patterns] | Examples include Data Confidentiality, Data Origin Authentication, Direct Authentication, Brokered Authentication | ||
16. [http://www.soapatterns.org/masterlist_c.asp#ch21 Transformation Patterns] | |||
The Patterns proposed in this category concrete on how data from one data model can be dynamically converted to comply to a different data model. | The Patterns proposed in this category concrete on how data from one data model can be dynamically converted to comply to a different data model. | ||
Examples for this category are Data Model Transformation, Data Format Transformation, Protocol Bridging | |||
[http://www.soapatterns.org/masterlist_c.asp#ch22 Common Compound Design Patterns] | 17. [http://www.soapatterns.org/masterlist_c.asp#ch22 Common Compound Design Patterns] | ||
A compound pattern is a coarse-grained pattern comprised of a set of finer-grained patterns. | A compound pattern is a coarse-grained pattern comprised of a set of finer-grained patterns. | ||
Examples include Orchestration, Enterprise Service Bus, Service Broker, Canonical Schema Bus, Official Endpoint, Federated Endpoint Layer, Three-Layer Inventory | |||
=Example Design Patterns = | =Example Design Patterns = | ||
The following section describes five design patterns which are utilized in SOA. The described patterns provide the problem and corresponding solution.The figures for the following examples are taken from corresponding sections of [http://www.soapatterns.org/masterlist_a.asp soapatterns.org] | |||
==Canonical protocol== | ==Canonical protocol== | ||
[[Image:Canonicalpattern.jpg.png]] | [[Image:Canonicalpattern.jpg.png]] | ||
''Canonical Protocol Figure as given in SOA Patterns website'' | |||
Problem: Services that support different communication technologies compromise interoperability, limit the quantity of potential consumers, and introduce the need for undesirable protocol bridging measures. | Problem: Services that support different communication technologies compromise interoperability, limit the quantity of potential consumers, and introduce the need for undesirable protocol bridging measures. | ||
Line 126: | Line 159: | ||
From the above figure it is observed that | From the above figure it is observed that the services are delivered by three different communication technologies A,B and C.These services are made to conform to one centralized communications technology, making them technologically compatible.with this these services can be delivered to consumers without much difficulty | ||
==Dual protocol== | ==Dual protocol== | ||
Line 132: | Line 165: | ||
[[Image:dualprotocol.png]] | [[Image:dualprotocol.png]] | ||
''Dual Protocol figure as given in SOA Pattern Official Website'' | |||
Problem: Canonical Protocol requires that all services conform to the use of the same communications technology; however, a single protocol may not be able to accommodate all service requirements, thereby introducing limitations. | Problem: Canonical Protocol requires that all services conform to the use of the same communications technology; however, a single protocol may not be able to accommodate all service requirements, thereby introducing limitations. | ||
Line 143: | Line 178: | ||
[[Image:protocolbridging.png]] | [[Image:protocolbridging.png]] | ||
''Protocol Bridging Figure as given in the SOA Patterns Official Website'' | |||
Problem: Services using different communication protocols or different versions of the same protocol cannot exchange data. | Problem: Services using different communication protocols or different versions of the same protocol cannot exchange data. | ||
Line 148: | Line 185: | ||
Solution: Bridging logic is introduced to enable communication between different communication protocols by dynamically converting one protocol to another at runtime. | Solution: Bridging logic is introduced to enable communication between different communication protocols by dynamically converting one protocol to another at runtime. | ||
From the above figure it can be noticed that the consumer programs interact with a middle-tier broker that provides protocol bridging features. | From the above figure it can be noticed that the consumer programs interact with a middle-tier broker that provides protocol bridging features.The consumer programs may be using different protocols like [http://java.sun.com/products/jms/ JMS] or SOAP 1.1.In order to translate the two incompatible protocols in to the required SOAP 1,2 with HTTP separate protocol adapters are used in the broker. The broker then transmits the messages to the service on behalf of the consumers.Therefore the protocol bridging is achieved. | ||
==UI Mediator== | ==UI Mediator== | ||
Line 154: | Line 191: | ||
[[Image:uimediator.png]] | [[Image:uimediator.png]] | ||
''Figure of UI Mediator as given in Official SOA Patterns Website'' | |||
Problem: Because the behavior of individual services can vary depending on their design,runtime usage, and the workload required to carry out a given capability, the consistency with which a service-oriented solution can respond to requests originating from a user-interface can fluctuate, leading to a poor user experience. | Problem: Because the behavior of individual services can vary depending on their design,runtime usage, and the workload required to carry out a given capability, the consistency with which a service-oriented solution can respond to requests originating from a user-interface can fluctuate, leading to a poor user experience. | ||
Line 160: | Line 199: | ||
In this method as can be observed from the figure the three services A,B and C work behind the scenes to complete the given task.The mediator service (D) regularly updates the user interface there by hiding the underlying logic to the consumer. | |||
==Service Facade== | ==Service Facade== | ||
Line 166: | Line 205: | ||
[[Image:service_facade.png]] | [[Image:service_facade.png]] | ||
''Figure for Service Facade as given in the official SOA Pattern Site'' | |||
Problem: The coupling of the core service logic to contracts and implementation resources can inhibit its evolution and negatively impact service consumers. | Problem: The coupling of the core service logic to contracts and implementation resources can inhibit its evolution and negatively impact service consumers. | ||
Line 171: | Line 212: | ||
Solution: A service facade component is used to abstract a part of the service architecture with negative coupling potential. | Solution: A service facade component is used to abstract a part of the service architecture with negative coupling potential. | ||
Facade logic is placed in between the contract and the core service logic. This allows the core service logic to remain decoupled from the contract. | Facade logic is placed in between the contract and the core service logic. This allows the core service logic to remain decoupled from the contract.The objective of loose coupling is achieved by this process.the core logic abstraction is obtained by this way. | ||
=Similarities and Differences Between Patterns for SOA and Traditional pattens proposed by GoF= | |||
The Gang of Four(Gof) comprising of Eric Gamma, Richard Helm, Ralph Johnson, and John Vlissides have documented the design patterns that were followed by Software developers and architects in object oriented space. They have documented 23 design patterns which are collectively called as Traditional design patterns. | |||
The design patterns in SOA are similiar in some aspects to the traditional patterns.They also differ from the traditional patterns. The similiarities and differences between them are provided in this section | |||
==Differences== | |||
The differences between the SOA design patterns and traditional design patterns have been come up based on the individual functionality that each pattern provide. Following are the differences, | |||
1) The [http://en.wikipedia.org/wiki/Composite_pattern composite pattern] organizes the objects in the manner to represent the part-whole hierarchies in a traditional two-tier hierarchy. | |||
The [http://www.soapatterns.org/agnostic_subcontroller.asp agnostic sub-controller] implements the service composability but it differs from the composite pattern in such a way that cross-entity functionality is abstracted and made accessible through the sub –controller capability. | |||
For instance, the traditional composite pattern has the object representing a part-whole hierarchy as in the below figure of graphic class which has draw(). If we require a cross-entity functionality as in the below figure, we require a colored rectangle, we require the functionality fill() of color class. Hence the sub-controller module is created which has the functionality of different parents, thus making it reusable. | |||
''Figure to illustrate above difference'' | |||
[[Image:Composite_example.png]] | |||
2) | |||
The traditional [http://en.wikipedia.org/wiki/Bridge_pattern bridge pattern] separates the abstraction from its implementation in order to vary independently. Whereas the [http://www.soapatterns.org/canonical_protocol.asp canonical protocol] avoids the protocol bridging in such a way that there is a single communication technology through which the services can interact. | |||
In the below figure of bridge pattern, the relationship between the abstraction and implementor is bridge and it results the implementor to vary independently from the abstraction by having different ConcreteImplementor. The canonical protocol avoids the variation by having a single communication technology between different objects. | |||
''Figure to illustrate above difference'' | |||
[[Image:Traditional_bridge.png]] | |||
''Figure for Traditional bridge pattern (Source: Elements of Reusable Object-Oriented Software by Gang of Four)'' | |||
For canonical protocol refer to the explanation given in example design patterns | |||
3) The traditional [http://en.wikipedia.org/wiki/Builder_pattern builder pattern] decouples the construction of the object from its representation so that the same construction process can be used to develop different representations. The different representations (contracts) are addressed in SOA by the [http://www.soapatterns.org/concurrent_contracts.asp Concurrent Contracts] with the application of [http://www.soapatterns.org/service_facade.asp Service-façade] design pattern. With service-façade design pattern, an abstraction is created to support the interaction between different contracts. As a result, different contracts can be created for a single service. | |||
In the below figure, the conversion of the text document is separated from the reader of RTF document, so that the text document can be represented in different forms like ASCIIText, TeXText and TextWidget. The different representation is achieved by decoupling of construction and abstraction. In the case of concurrent contracts pattern, the different contracts or services (invoices) are created for different consumer through service-façade by creating a new abstraction. | |||
[[Image:Builder.png]] | |||
''Figure for Traditional Builder pattern (Source: Elements of Reusable Object-Oriented Software by Gang of Four)'' | |||
[[Image:Concurrent_pattern.png]] | |||
''Figure for Concurrent Contracts pattern (Source: SOA Patterns website)'' | |||
==Similarities== | |||
1) The [http://www.soapatterns.org/service_facade.asp Service-façade] design pattern is similar to the [http://en.wikipedia.org/wiki/Facade_pattern façade] (traditional) pattern in the manner that it implements the façade logic which is creating an abstraction for intra-communication within objects to the service architecture. The advantage by adding the façade logic to the service architecture is that it preserves the underlying logic from run-time changes. | |||
2) The [http://www.soapatterns.org/ui_mediator.asp UI Mediator] design pattern implements the [http://en.wikipedia.org/wiki/Mediator_pattern mediator] logic of traditional mediator pattern. The mediator logic aims to provide the user responses in a way that user understands, independently of what the underlying services perform. | |||
3) The [http://www.soapatterns.org/intermediate_routing.asp Intermediate routing] pattern in SOA is similar to [http://en.wikipedia.org/wiki/Decorator_pattern Decorator pattern] (traditional) in the functionality that it adds the required logic at run-time. The decorator adds the additional functionality to the object at run-time. The intermediate routing pattern is about placing the routing logic to address the run-time scenarios. | |||
4)The [http://www.soapatterns.org/capability_composition.asp Capability Composition] pattern in SOA implements the [http://en.wikipedia.org/wiki/Composite_pattern Composite pattern] (traditional). The Capability Composition is about composing one or more capabilities outside the service’s context to address the large, complex problem. | |||
5) The [http://www.soapatterns.org/decoupled_contract.asp Decoupled Contract] pattern implements the traditional [http://en.wikipedia.org/wiki/Bridge_pattern Bridge pattern] in the manner that service contract is separated from the implementation. The Bridge pattern decouples the abstraction from implementation to facilitate the variation of both (abstraction and implementation). | |||
6) The [http://www.soapatterns.org/legacy_wrapper.asp Legacy Wrapper] pattern is related to traditional [http://en.wikipedia.org/wiki/Adapter_pattern Adapter pattern]. The Legacy Wrapper pattern protects the legacy logic by providing a standard service that takes of protecting the legacy details by encapsulating, extraction or elimination. The encapsulation, extraction or elimination is done in order to change the service as the consumer requires it. This is related to adapter in a way that it converts the interface of one class to another as the client expects. | |||
=Summary= | |||
The various patterns in Service oriented Architecture which have been currently proposed were studied and an attempt was made to document all of them by categories.Few detailed examples are documented to get an understanding of the underlying process.Specific comparison of design patterns in SOA domain and corresponding traditional patterns has been carried out.The design patterns in SOA are still under development and many patterns are coming up due to vast technology used in this domain. | |||
=Glossary= | =Glossary= | ||
Serive : "A service is a discoverable resource that executes a repeatable task, and is described by an externalized service specification." | 1.Serive : "A service is a discoverable resource that executes a repeatable task, and is described by an externalized service specification." | ||
[http://www.com/developerworks/webservices/library/ws-soa-term1/ SOA Terminology] | 2.[http://www.ibm.com/developerworks/webservices/library/ws-soa-term1/ SOA Terminology]: SOA Terminology is all about Service, architecture, governance and business terms. | ||
SOA :[http://en.wikipedia.org/wiki/Service-oriented_architecture Service oriented Architecture] | 3.SOA :[http://en.wikipedia.org/wiki/Service-oriented_architecture Service oriented Architecture]: SOA is an architectural style used for creating IT architecture that supports a strong relationship between business and information systems. | ||
API :[http://en.wikipedia.org/wiki/Application_programming_interface Application programming interface] | 4.API :[http://en.wikipedia.org/wiki/Application_programming_interface Application programming interface]: An interface used by the application to obtain the services from libraries or operating system. | ||
SOAP :[http://en.wikipedia.org/wiki/SOAP Simple Object Access Protocol] | 5.SOAP :[http://en.wikipedia.org/wiki/SOAP Simple Object Access Protocol]: A protocol used for the exchange of structured information in Web Services implementation. | ||
HTTP :[http://en.wikipedia.org/wiki/HyperText_Transfer_Protocol Hypertext Transfer Protocol] | 6.HTTP :[http://en.wikipedia.org/wiki/HyperText_Transfer_Protocol Hypertext Transfer Protocol]: A protocol used for distributing hypertext documents (mostly used in the web pages implementation) | ||
GoF :[http://en.wikipedia.org/wiki/Design_Patterns:_Elements_of_Reusable_Object-Oriented_Software Gang of Four] | 7.GoF :[http://en.wikipedia.org/wiki/Design_Patterns:_Elements_of_Reusable_Object-Oriented_Software Gang of Four]: Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides | ||
[http://soaglossary.com/ SOA Glossory] | 8.[http://soaglossary.com/ SOA Glossory]: Comprehensive list of glossaries used in SOA domain. | ||
=References= | =References= | ||
1.[http://en.wikipedia.org/wiki/Design_Patterns:_Elements_of_Reusable_Object-Oriented_Software Design patterns for object oriented software] | |||
2.[http://en.wikipedia.org/wiki/Service-oriented_architecture#Introduction Service Oriented Architecture] | |||
3.[http://www.exforsys.com/tutorials/soa/soa-definitions-and-certification.html SOA Tutorial] | |||
4.[http://www.soapatterns.org/ soa design patterns] | |||
5.[http://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29 design pattern] | |||
6.[http://www.oracle.com/technologies/soa/center.html oracle SOA centre] | |||
7.[http://www.ibm.com/developerworks/webservices/library/ws-soa-term1/ IBMs SOA Contributions] | |||
8.[http://www.oracle.com/technology/pub/articles/erl_soa_design_patterns_app_sequences.html SOA Design patterns application sequences by oracle] | |||
9.SOA Design Patterns by Thomas Erl |
Latest revision as of 01:53, 15 October 2009
CSC/ECE 517 Fall 2009/wiki2 16 rs
SOA provides another view of providing functionality based upon services offered in terms of protocols and a specific API. Research and report on what patterns have been proposed and are utilized within this domain. How do they differ from traditional design patterns proposed by Eric Gamma, Richard Helm, Ralph Johnson, and John Vlissides? How are they similar?
Introduction
This article focuses on the design patterns which are proposed and utilized in the Service Oriented Architecture. As the SOA provides its services through the protocols and API, this article throws light on the design patterns that specifically provide services through protocols like Canonical protocol, Dual protocols and Protocol Bridging. In a broader perspective, other design patterns have been explained tersely. In addition to explanation of the SOA design patterns, this compares the SOA design patterns with the traditional design patterns proposed by the ‘Gang of Four’ (Eric Gamma, Richard Helm, Ralph Johnson, and John Vlissides) and comes up with the differences and similarities between them.
Service Oriented Architecture-An Overview
SOA-Definition
A Service Oriented Architecture is an architecture that provides collection of services. These services need to inter-operate with each other to provide the functionality. This architecture requires a loose coupling with operating systems and other technologies that form the basis of the application. The loose coupling between services is required because each interaction has to be independent of the other. The communication between services could be either simple data being passed or it could be either an activity coordinated between distinct entities or services. Some means of interoperability is required to provide the services in larger terms. Instead of defining the API, the SOA implements the interfaces using the protocols and functionality. SOA separates functions into unique entities or services, which are accessed in a network by the users to combine and reuse them to develop the applications.
Why SOA?
Various businesses in the field of Information Technology have to justify their projects with a return on their investments. This creates a pressure in Information Technology by making it a demanding field. Information Technology needs to have requirements in a way that it has to responsive and adapt to the changing requirements.
Information Technology companies must also be able to provide the services that are compatible with other services making it interoperable, thus creating dynamic services. Moreover, Information Technology has to face demands to bring new commercial services to a much wider array of customers. Customers may access services through web interfaces, or may be part of a supply chain that needs to decrease the time and cost of manufacturing.
Thus, Information Technology companies are always on the look out for solutions that will help them meet the above demands – without having to spend a lot of money. Service Oriented Architecture offers a solution to satisfy the above needs of the industry
SOA-Benifits
In architectural terms, a modern architectural design should be Service Oriented, loosely coupled, driven by events, able to support both integration and assembly, aligned with valuable life cycle support processes, and able to leverage existing infrastructure and applications.
When it comes to Service Oriented Architecture, it tends to offer a variety of different advantages over more traditional methods of distributing computing. These include i) business services across several platforms ii) location independence iii) authentication as well as authorization support on different platforms iv ) loosely coupled approach, dynamic search and connectivity to other services.
Design Patterns in SOA
A design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be applied in different scenarios. Design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved.
Design patterns play a major role in SOA. The implementation and deployment of SOA designs provide different challenges during product development life cycle.Such challenges may make projects to be discontinued. Design patterns help in overcoming these problems by providing a solution to the problems posed. Each SOA design pattern provides a design solution in support of successfully applying service orientation and establishing a quality service-oriented architecture
Design Patterns proposed
The proposed Design Patterns for SOA fall in to following categories. They are listed below and corresponding patterns in each category are given. Detailed explanation of the design patterns given in the example can be found in the link provided for each category.
1. Foundational Inventory Patterns
These design patterns focus on providing solutions to the problems like maximizing re-composition and avoiding redundant logic.
Examples include Enterprise Inventory, Domain Inventory, Service Normalization, Logic Centralization, Service Layers Canonical Protocol, Canonical Schema
2. Logical Inventory Layer Patterns
These design patterns provide the solution to the problem of how can business logic be separated, reused, and governed independently.
Examples for this category are Utility Abstraction, Entity Abstraction, Process Abstraction
3. Inventory Centralization Patterns
These patterns focus on providing solution for aspect of governing business logic etc
Examples for this category are Process Centralization, Schema Centralization, Policy Centralization, Rules Centralization.
4. Inventory Implementation Patterns
These patterns help to solve implementation problems like limitations introduced by communication technology. Example like a single protocol may not accommodate all requirements etc
Examples for this category are Dual Protocols, Canonical Resources, State Repository, Stateful Services, Service Grid, Inventory Endpoint, Cross-Domain Utility Layer
5. Inventory Governance Patterns
The patterns deal with the governance problems caused by service contract within the same service inventory
Examples include Canonical Expression, Metadata Centralization, Canonical Versioning
6. Foundational Service Patterns
The patterns proposed in this category focus on solving large business problems without having to build a stand alone solution.
Examples for this category are Functional Decomposition, Service Encapsulation, Agnostic Context, Non-Agnostic Context, Agnostic Capability
7. Service Implementation Patterns
The patterns in this category focus on improving the realiability and availability of the service
Examples include Service Facade, Redundant Implementation, Service Data Replication, Partial State Deferral, Partial Validation, UI Mediator
The patterns proposed in this category deal with the problem of data encapsulation and security aspects.
Examples for this category are Exception Shielding, Message Screening, Trusted Subsystem, Service Perimeter Guard
9. Service Contract Design Patterns
The patterns proposed in this category focus on providing solution for how to make the service contract suitable for all potential customers,make it aligned with other services etc
Examples for this category are Decoupled Contract, Contract Centralization, Contract De normalization, Concurrent Contracts, Validation Abstraction
10. Legacy Encapsulation Patterns
The patterns proposed deals with the problems in legacy systems like processing of data contained in flat files, redundancy resulting in delivery to multiple channels etc
Examples for this category are Legacy Wrapper, Multi-Channel Endpoint, File Gateway
11. Service Governance Patterns
These patterns provide solution for problems like updating the customers with changed service so that they are not affected, modifications in service etc
Examples for this category are Compatible Change, Version Identification, Termination Notification, Service Refactoring, Service Decomposition, Proxy Capability, Decomposed Capability, Distributed Capability
12. Capability Composition Patterns
The pattern proposed focuses on the problem of How can a service capability solve a problem that requires logic outside of the service boundary and How can the same capability be used to help solve multiple problems?
Examples for this category are Capability Composition, Capability Recomposition
13. Service Messaging Patterns
The patterns proposed in this category focus on setting up of message framework for transfer of data.
Examples in this category are Service Messaging, Messaging Metadata, Service Agent, Intermediate Routing, State Messaging, Service Callback, Service Instance Routing, Asynchronous Queuing, Reliable Messaging, Event-Driven Messaging.
14. Composition Implementation Patterns
The patterns proposed in this category focus on problems during runtime like runtime activities that span multiple services fail, the parent business task is incomplete etc
Examples for this category are Agnostic SubController, Composition Autonomy, Atomic Service Transaction, Compensating ServiceTransaction
15. Service Interaction Security Patterns
The proposed patterns in this category are focused on security methods like encryption,decryption,authenticating the data,consumer and service
Examples include Data Confidentiality, Data Origin Authentication, Direct Authentication, Brokered Authentication
The Patterns proposed in this category concrete on how data from one data model can be dynamically converted to comply to a different data model.
Examples for this category are Data Model Transformation, Data Format Transformation, Protocol Bridging
17. Common Compound Design Patterns
A compound pattern is a coarse-grained pattern comprised of a set of finer-grained patterns.
Examples include Orchestration, Enterprise Service Bus, Service Broker, Canonical Schema Bus, Official Endpoint, Federated Endpoint Layer, Three-Layer Inventory
Example Design Patterns
The following section describes five design patterns which are utilized in SOA. The described patterns provide the problem and corresponding solution.The figures for the following examples are taken from corresponding sections of soapatterns.org
Canonical protocol
Canonical Protocol Figure as given in SOA Patterns website
Problem: Services that support different communication technologies compromise interoperability, limit the quantity of potential consumers, and introduce the need for undesirable protocol bridging measures.
Solution: The architecture establishes a single communications technology as the sole or primary medium by which services can interact.
From the above figure it is observed that the services are delivered by three different communication technologies A,B and C.These services are made to conform to one centralized communications technology, making them technologically compatible.with this these services can be delivered to consumers without much difficulty
Dual protocol
Dual Protocol figure as given in SOA Pattern Official Website
Problem: Canonical Protocol requires that all services conform to the use of the same communications technology; however, a single protocol may not be able to accommodate all service requirements, thereby introducing limitations.
Solution: The service inventory architecture is designed to support services based on primary and secondary protocols.
Regardless of protocol, all services must invoke each other via their official service contracts (A, B). Bypassing the contract may seem convenient when the underlying service logic of the primary service supports the same protocol as the secondary service (C), but it is an anti-pattern that will eventually inhibit the application of this pattern and further weaken the overall service inventory foundation.
Protocol Bridging
Protocol Bridging Figure as given in the SOA Patterns Official Website
Problem: Services using different communication protocols or different versions of the same protocol cannot exchange data.
Solution: Bridging logic is introduced to enable communication between different communication protocols by dynamically converting one protocol to another at runtime.
From the above figure it can be noticed that the consumer programs interact with a middle-tier broker that provides protocol bridging features.The consumer programs may be using different protocols like JMS or SOAP 1.1.In order to translate the two incompatible protocols in to the required SOAP 1,2 with HTTP separate protocol adapters are used in the broker. The broker then transmits the messages to the service on behalf of the consumers.Therefore the protocol bridging is achieved.
UI Mediator
Figure of UI Mediator as given in Official SOA Patterns Website
Problem: Because the behavior of individual services can vary depending on their design,runtime usage, and the workload required to carry out a given capability, the consistency with which a service-oriented solution can respond to requests originating from a user-interface can fluctuate, leading to a poor user experience.
Solution: Establish mediator logic solely responsible for ensuring timely interaction and feedback with user-interfaces and presentation logic.
In this method as can be observed from the figure the three services A,B and C work behind the scenes to complete the given task.The mediator service (D) regularly updates the user interface there by hiding the underlying logic to the consumer.
Service Facade
Figure for Service Facade as given in the official SOA Pattern Site
Problem: The coupling of the core service logic to contracts and implementation resources can inhibit its evolution and negatively impact service consumers.
Solution: A service facade component is used to abstract a part of the service architecture with negative coupling potential.
Facade logic is placed in between the contract and the core service logic. This allows the core service logic to remain decoupled from the contract.The objective of loose coupling is achieved by this process.the core logic abstraction is obtained by this way.
Similarities and Differences Between Patterns for SOA and Traditional pattens proposed by GoF
The Gang of Four(Gof) comprising of Eric Gamma, Richard Helm, Ralph Johnson, and John Vlissides have documented the design patterns that were followed by Software developers and architects in object oriented space. They have documented 23 design patterns which are collectively called as Traditional design patterns.
The design patterns in SOA are similiar in some aspects to the traditional patterns.They also differ from the traditional patterns. The similiarities and differences between them are provided in this section
Differences
The differences between the SOA design patterns and traditional design patterns have been come up based on the individual functionality that each pattern provide. Following are the differences,
1) The composite pattern organizes the objects in the manner to represent the part-whole hierarchies in a traditional two-tier hierarchy.
The agnostic sub-controller implements the service composability but it differs from the composite pattern in such a way that cross-entity functionality is abstracted and made accessible through the sub –controller capability.
For instance, the traditional composite pattern has the object representing a part-whole hierarchy as in the below figure of graphic class which has draw(). If we require a cross-entity functionality as in the below figure, we require a colored rectangle, we require the functionality fill() of color class. Hence the sub-controller module is created which has the functionality of different parents, thus making it reusable.
Figure to illustrate above difference
2) The traditional bridge pattern separates the abstraction from its implementation in order to vary independently. Whereas the canonical protocol avoids the protocol bridging in such a way that there is a single communication technology through which the services can interact.
In the below figure of bridge pattern, the relationship between the abstraction and implementor is bridge and it results the implementor to vary independently from the abstraction by having different ConcreteImplementor. The canonical protocol avoids the variation by having a single communication technology between different objects.
Figure to illustrate above difference
Figure for Traditional bridge pattern (Source: Elements of Reusable Object-Oriented Software by Gang of Four)
For canonical protocol refer to the explanation given in example design patterns
3) The traditional builder pattern decouples the construction of the object from its representation so that the same construction process can be used to develop different representations. The different representations (contracts) are addressed in SOA by the Concurrent Contracts with the application of Service-façade design pattern. With service-façade design pattern, an abstraction is created to support the interaction between different contracts. As a result, different contracts can be created for a single service.
In the below figure, the conversion of the text document is separated from the reader of RTF document, so that the text document can be represented in different forms like ASCIIText, TeXText and TextWidget. The different representation is achieved by decoupling of construction and abstraction. In the case of concurrent contracts pattern, the different contracts or services (invoices) are created for different consumer through service-façade by creating a new abstraction.
Figure for Traditional Builder pattern (Source: Elements of Reusable Object-Oriented Software by Gang of Four)
Figure for Concurrent Contracts pattern (Source: SOA Patterns website)
Similarities
1) The Service-façade design pattern is similar to the façade (traditional) pattern in the manner that it implements the façade logic which is creating an abstraction for intra-communication within objects to the service architecture. The advantage by adding the façade logic to the service architecture is that it preserves the underlying logic from run-time changes.
2) The UI Mediator design pattern implements the mediator logic of traditional mediator pattern. The mediator logic aims to provide the user responses in a way that user understands, independently of what the underlying services perform.
3) The Intermediate routing pattern in SOA is similar to Decorator pattern (traditional) in the functionality that it adds the required logic at run-time. The decorator adds the additional functionality to the object at run-time. The intermediate routing pattern is about placing the routing logic to address the run-time scenarios.
4)The Capability Composition pattern in SOA implements the Composite pattern (traditional). The Capability Composition is about composing one or more capabilities outside the service’s context to address the large, complex problem.
5) The Decoupled Contract pattern implements the traditional Bridge pattern in the manner that service contract is separated from the implementation. The Bridge pattern decouples the abstraction from implementation to facilitate the variation of both (abstraction and implementation).
6) The Legacy Wrapper pattern is related to traditional Adapter pattern. The Legacy Wrapper pattern protects the legacy logic by providing a standard service that takes of protecting the legacy details by encapsulating, extraction or elimination. The encapsulation, extraction or elimination is done in order to change the service as the consumer requires it. This is related to adapter in a way that it converts the interface of one class to another as the client expects.
Summary
The various patterns in Service oriented Architecture which have been currently proposed were studied and an attempt was made to document all of them by categories.Few detailed examples are documented to get an understanding of the underlying process.Specific comparison of design patterns in SOA domain and corresponding traditional patterns has been carried out.The design patterns in SOA are still under development and many patterns are coming up due to vast technology used in this domain.
Glossary
1.Serive : "A service is a discoverable resource that executes a repeatable task, and is described by an externalized service specification."
2.SOA Terminology: SOA Terminology is all about Service, architecture, governance and business terms.
3.SOA :Service oriented Architecture: SOA is an architectural style used for creating IT architecture that supports a strong relationship between business and information systems.
4.API :Application programming interface: An interface used by the application to obtain the services from libraries or operating system.
5.SOAP :Simple Object Access Protocol: A protocol used for the exchange of structured information in Web Services implementation.
6.HTTP :Hypertext Transfer Protocol: A protocol used for distributing hypertext documents (mostly used in the web pages implementation)
7.GoF :Gang of Four: Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
8.SOA Glossory: Comprehensive list of glossaries used in SOA domain.
References
1.Design patterns for object oriented software
2.Service Oriented Architecture
8.SOA Design patterns application sequences by oracle
9.SOA Design Patterns by Thomas Erl