Comments
yourfanat wrote: I am using another tool for Oracle developers - dbForge Studio for Oracle. This IDE has lots of usefull features, among them: oracle designer, code competion and formatter, query builder, debugger, profiler, erxport/import, reports and many others. The latest version supports Oracle 12C. More information here.
Cloud Computing
Conference & Expo
November 2-4, 2009 NYC
Register Today and SAVE !..

2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
In many cases, the end of the year gives you time to step back and take stock of the last 12 months. This is when many of us take a hard look at what worked and what did not, complete performance reviews, and formulate plans for the coming year. For me, it is all of those things plus a time when I u...
SYS-CON.TV
SOA Patterns: Basic Structural Patterns - Part 1
Solving some of the more common issues related to services

A more plausible option is to create a library of common tasks and have each service work with the library's API. This helps a bit, but you are still left with coding the wiring that is needed to utilize all of the library's functionality.

Another option is using inheritance to create a superclass that implements the common functionality and have each service inherit from that class. Using inheritance is also problematic since the service functionality usually won't fit within a single class, due to the granularity of what a service is. In addition, different services handle completely different business areas - otherwise they would be the same service, so it usually doesn't make sense to make them a single class hierarchy.

Using inheritance almost solves our problem as we write the code once and the customization only occurs where the services differ - if we want to get the same behavior without using inheritance we need to use a framework.

The Solution
Create a common ServiceHost component that acts as a container or a framework for services. The container is configurable and performs the wiring and setup of services (see Figure 2).

The ServiceHost acts as a mini-framework that can have several responsibilities. The first responsibility is to instantiate the right components or classes that the service consists of. The ServiceHost is also responsible for reading configuration information, for instance, the ServiceHost can read the port that consumers can use to contact the service. Another responsibility is to set up the service's environment, for example, setting up listeners on the endpoint. Last, the ServiceHost can be responsible for wiring the components - binding a protocol to the listener to an endpoint or setting up a connection to the database. The common denominator of these responsibilities is that they are all related to instantiating and initializing services and, as we've seen in the problem introduction, you are likely to encounter them in more than one service. As mentioned earlier, the ServiceHost is a framework, which is a little different from the library concept mentioned in option two. Basically it's a collection of utility classes/methods your code can call on to get some functionality. Frameworks, on the other hand, contain some functionality or flow and call your code to extend or make the flow a specific one. The principle of frameworks calling your code is known as "Inversion of Control." It is in wide use in object-oriented frameworks such as Spring or Spring.NET, picocontainers, and the like.

The ServiceHost pattern has several benefits compared with the other options. One benefit was already mentioned - as a framework the ServiceHost performs the work and only calls your code to fine-tune the behavior rather than leaving this orchestration to you. Another benefit is that it better addresses the Open Closed Principle (OCP). OCP states that a class should be open to extension but closed for modification, which is exactly what we get when we use the framework concept.

A ServiceHost may host more than one service - though this is probably not very common. There was one system I built where we had to scale a solution down to run on a single computer and this was handy. The more likely situation is that a service would span more than one computer and then you would have several ServiceHost instances, each hosting parts of the service rather than the complete service

The ServiceHost pattern is commonly used by technology vendors - we can see that in the technology mapping section.

Technology Mapping
This section takes a brief look at what it means to implement the pattern using existing technologies and mentions where technologies implement the pattern.

The ServiceHost is a fundamental SOA structural pattern and as such it is supported by most available technologies. Both JAX-WS and Windows Communication Foundation let you configure your services in markup (XML) and have the web server, i.e., the servlet engine or IIS, do most of the wiring for you.

Windows Communication Foundation also has a class called ServiceHost. Microsoft's documentation describes the ServiceHost as follows: "Use the ServiceHost class to configure and expose a service for use by client applications when you are not using Internet Information Services (IIS) or Windows Activation Services (WAS) to expose a service. Both IIS and WAS interact with a ServiceHost object on your behalf." Basically the built-in WCF implementation of a ServiceHost is very much in line with the pattern described here.

If you are implementing the ServiceHost pattern by yourself, perhaps on top of the technology one, you can take a look at a lightweight container like Sprint (or Spring.NET), picocontainers, etc., to help you out with wiring and instantiation. There aren't many other technological implications as the ServiceHost pattern is a relatively simple pattern.

Lightweight Containers and Dependency Injection
Spring and a few other frameworks are known as "lightweight containers." The nice thing about these "Lightweight containers" is that they allow you to increase loose coupling and the testability of your solutions. They perform this magic through the use of the Dependency Injection Pattern, which is a non-SOA pattern. Dependency Injection, as the name implies, happens when a class lets a third party that acts as an "assembler" provide the interfaces it depends on. Using Dependency Injection, a class no longer has to depend on a specific implementation but rather it depends only on the interface or abstract class. This helps increase testability as you can now supply stubs or mocks for the class to simulate its environment. It also helps flexibility as you can easily change the implementation of the dependencies as long as they keep their contract.

As we've seen, the ServiceHost Pattern is simple but effective and is widely used. You can take a look at the Further Reading section at the end for links to resources that expand on the technologies mentioned in this section.

Quality Attribute Scenarios
The quality attribute scenarios section talks about the architectural benefits of utilizing patterns from the requirements perspective. Most of the architectural requirements are described from the perspective of quality attributes (scalability, flexibility, performance, etc.) through the use of scenarios where these attributes are manifested. The scenarios can also be used as a reference for situations where the pattern is applicable.

The main reason to use the ServiceHost pattern is reusability. Reusability is increased by the fact that common tasks that are needed by many services are written only once. A nice side-effect of reusability is also increased reliability as you also only need to debug once. The other quality attribute the ServiceHost Pattern provides is portability. Portability is enhanced by the separation of concern effect of the pattern, as was demonstrated in the scale-down example I mentioned earlier. Another facet of portability comes from the ability to configure the service context in markup.

•   •   •

This article is based on the book SOA Patterns (http://www.manning.com/rotem) scheduled to print February 2009. This article is courtesy of Manning Publications (http://www.manning.com). The ebook is available and sold exclusively through Manning Publications.

About Arnon Rotem-Gal-Oz
For the past 10 years Arnon Rotem-Gal-Oz has been an architecture and system designer of large distributed systems including C4ISR systems, IP customer care and billing systems, and BI engines. He has experience with a variety of technologies (.Net, J2EE, CORBA, COM+, X-Windows) on diverse platforms (Unix, Windows, Dos, AS/400). He currently works for Rafael as the Biometric line development manager.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

SOA World Latest Stories
SYS-CON Events announced today that DatacenterDynamics has been named “Media Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY. DatacenterDynamics is a brand of DCD Group, a global B2B media and publ...
"We do one of the best file systems in the world. We learned how to deal with Big Data many years ago and we implemented this knowledge into our software," explained Jakub Ratajczak, Business Development Manager at MooseFS, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8...
CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one l...
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO within the program. Successful transformation requires a laser focus ...
Enterprise architects are increasingly adopting multi-cloud strategies as they seek to utilize existing data center assets, leverage the advantages of cloud computing and avoid cloud vendor lock-in. This requires a globally aware traffic management strategy that can monitor infrastruct...
Containers and Kubernetes allow for code portability across on-premise VMs, bare metal, or multiple cloud provider environments. Yet, despite this portability promise, developers may include configuration and application definitions that constrain or even eliminate application portabil...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE