FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Architecture & Design
IF YOU BUILD IT

... Will they Come?

by Arnon Rotem-Gal-Oz

March 2008


March 31, 2008

Defining SOA - Part IV - Pipes and Filters


This post is part of a series of posts trying to define SOA as an architectural style. In the previous post I talked about SOA and the Layered architecture style (which generated a couple of follow-ups - one on layered architecture in general, one on its importance for SOA and on on layers in enterprise architecture vs. solution architecture)

The next architectural style SOA builds on is Pipes and Filters, Unlike Layers and Client/server which I described in previous installments, Pipes and Filter is not also a base style for REST. This basically, this style is where SOA and REST begin to diverge.
The pipes and filters architectural style defines two types of components - yep you've guessed it, Pipes and Filters.

Filters -  are independent processing steps they are constrained to be autonomous of each other and not share state, control thread etc.
Pipes - are interconnecting channels


Each filter exposes a relatively simple interface where it can receive  messages on an inbound pipe, process tthem and produce  messages on outbound pipes. The idea behind this is to allow easy composability thus allowing greater usage (also known as "reuse" - I'll discuss the difference in another post). Systems are composed of several filters working together, filters can be replaced with newer version (provided they keep the same interface) etc.
On the downside the overall latency is increased , since to accomplish a task you have to move from filter to filter.

The pipes and filters style brings to SOA things like the autonomy of services, the sense of explicit boundaries. For instance, this is the basis for why you wouldn't want to do distributed transactions across service boundaries, which I blogged about several times before.

The pipes part of the "pipes and filters" also means that the wiring can be taken care of outside of the services themselves and that you can control them externally, this works well with ithe use of middleware (service bus). Additionally Fielding (you know, the REST guy) also mentions that

"One aspect of PF styles that is rarely mentioned is that there is an implied "invisible hand" that arranges the configuration of filters in order to establish the overall application. A network of filters is typically arranged just prior to each activation, allowing the application to specify the configuration of filter components based on the task at hand and the nature of the data streams (configurability). This controller function is considered a separate operational phase of the system, and hence a separate architecture, even though one cannot exist without the other."
Which is the harbinger of the orchestration/choreography aspects of SOA.

So as you see, pipes and filters is one of the important pilars of SOA, in the next part (unless I'll have to clarify things about this post) I'll talk about the last architectural style SOA builds upon "Distributed Agents".

Posted by Arnon Rotem-Gal-Oz at 11:17 AM  Permalink |


March 29, 2008

RESTful Windows Communication Foundation (WCF)


If you recall what I currently work on is a type of a visual search engine. In a nutshell when we get a request (image) we allocate a bunch of algorithmic engines in a grid like manner to process the image  (e.g. try to perform OCR or whatever). As it happens, we are developing the different components using several different environments(*) - e.g. the control bits run on windows (.NET) and most algorithms run on Linux (mostly C++).
The need for easy cross-platform communications and extensibility, the resource nature of the solution and a few other tidbits led us to design our solution in a RESTful manner.

If you are a .NET developer/architect and wanted you may know that to implement a RESTful application in Windows Communication Foundation (WCF) you really have to jump through hoops.For instance  you have to go back to basics and use the HttpRequest and HttpResponse, handle the breakdown and parsing of URI hierarchies yourself not to mention  fight  with the  bindings .

Fortunetly this all changed with WCF 3.5. True, .Net doesn't have (to my knowledge anyway) something like RESTlets, but at least building REST on http is pretty straightforward...

Consider for example the following excerpt:

    [ServiceContract(Namespace = "http://paperlnx.Contracts/2007/12", Name = "ISessions")]
    public interface ISessions
    {
        [OperationContract]
        [WebGet(UriTemplate = "/Sessions/{sessionId}")]
        [ServiceKnownType(typeof(Atom10FeedFormatter))]
        SyndicationFeedFormatter ListSessionStatus(string sessionId);
	.
	.
	.
With these 6 lines of code you see the essence of  the .NET 3.5 REST goodies
  1. Integrated support for HTTP verbs  - The sample above shows the support for GET. You can get the other verbs almost as easy with the WebInvoke Attribute. To do that simply specify the verb you want e.g.   [WebInvoke(Method = "PUT")] , [WebInvoke(Method="DELETE")] etc.
  2. Support for URI templates -  In a way not too far from Joe Gregorio's IETF draft , WCF supports the notion of providing a way to describe families of URIs. This is done using the UriTemplate class. The WebGet and WebInvoke attributes also accept URI templates as variables and map the variable values (the curly brackets ones {}) to parameters of methods.
  3. Support for standard  formats - you can use plain XML or you can choose to use RSS and ATOM syndication formats. In its most basic form you just create a syndicationfeed and format it to atom feed. Which is what we do for error messages:
            public static SyndicationFeedFormatter GenerateAtomError(string errormessage, string description,Uri location)
            {
                SyndicationFeed feed = new SyndicationFeed(errormessage, description, location);
                return new Atom10FeedFormatter(feed);
            }
    
    Naturally you can also add items and element extensions to all elements (e.g. the feed or items)
All in all, I am a happy camper :) After all, when you make an architectural decision, you always need to review it once you opted for an underlying technology. Even when a decision is right. The friction caused by a  technology which doesn't accommodate it well can both make your life miserable and make a good decision bad. .NET 3.5 with its newly added support for REST increases the architectural freedom and that's always a good thing




* Among other things, it helps us avoid the "Network is homogeneous" fallacy - but that's another story :)


Posted by Arnon Rotem-Gal-Oz at 03:40 PM  Permalink |



Dobb's Code talk


Dr. Dobb's launched a new forums/blogs platform called Dobb's Codetalk
I was told that posting there would automatically post here as well but it seems this is not the case.
First note that you can now find my blog there
Also I'll manually post the posts I've made there (following this post)

Posted by Arnon Rotem-Gal-Oz at 03:35 PM  Permalink |


March 06, 2008

Layers/Tiers: One More Time


Jack Van Hoof has a different view than I regarding the difference between Tiers and Layers.

I am not sure I agree with his view, but it still provides an interesting read. I think the main difference between our respective views is that Jack takes a look from the enterprise-architecture angle which gives him layers like:

  • Technical infrastructure; OS, directory Services etc.
  • Application infrastructure; Apps, Portals, DBMSs
  • Application Landscape; SOA, EDA
  • Bushiness Processes; BPM

Jack uses the term "tier" for layers within the same level of abstraction. For instance, he gives the following examples:

E.g. the layer of business services may be arranged in the tiers: front-office, mid-office and back-office. At the next lower layer, the application layer, services may be arranged in the tiers: UI, business logic and data persistency. The interaction of services between two tiers may be bidirectional (but may also be constrained to unidirectional).
The perspective I have (or at least try to maintain in this blog) is the solution/product line architecture -- basically living within Jack's application layers. So in my view I want to know and differentiate between the difference of having a UI and business logic live on the same machine vs. having them distributed in the world. So I guess in the end both perspectives need to have their place and the problem is (like often is the case) overloaded terms.

Posted by Arnon Rotem-Gal-Oz at 02:46 PM  Permalink |


March 04, 2008

SOA Patterns Book: Status Update


Great news. Two of my friends and fellow Dr. Dobb's bloggers, Eric Bruno and Udi Dahan, are participating in my (now "our's") SOA Patterns book, which will be published by Manning.

Both Udi and Eric are competent and experienced architects in designing SOAs . On the technology side, Udi ("The software simplest") specializes in .NET development; e.g., his nServiceBus framework is a very good example of an endpoint-ware ServiceBus (vs. middleware ServiceBuses which is what most ESBs do). For his part, Eric is a Java and C++ expert and author of Java Messaging (one of the best books on JMS and web services ) and has also has lots of experience in financial systems. Together, the three of us bring a
lot of real-life experience of building large and complicated system into this project.

The current game plan is for Eric to focus on the SOA pitfalls ("anti-patterns") part of the book, Udi to provide a "putting-it-all-together" chapter , and for me to cover what’s left. I am sure however, that their experience and insight will also help make the other parts of the book (even? ) better.

If you are not familiar with the book, you may want to take a look at the first chapter and/or some of the published patterns like Saga, Service Firewall, Gridable Service, Edge Component and (a very early draft of) Aggregated Reporting pattern. Also you can take a look at the slides from my "SOA Patterns" presentation at Dr. Dobb's Architecture & Design world last year, which illustrates some additional patterns.


Posted by Arnon Rotem-Gal-Oz at 12:08 AM  Permalink |



April 2008
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      


BLOGROLL
 
INFO-LINK