Friday, June 11, 2004
« .NET Rocks! show spurs UML discussion | Main | On the road with Roger Sessions and Jack... »

I recently had a reader of my business objects book ask about combining CSLA .NET and SOA concepts into a single application.

 

Certainly there are very valid ways of implementing services and client applications using CSLA such that the result fits nicely into the SOA world. For instance, in Chapter 10 I specifically demonstrate how to create services based on CSLA-style business objects, and in some of my VS Live presentations I discuss how consumption of SOA-style services fits directly into the CSLA architecture within the DataPortal_xyz methods (instead of using ADO.NET).

 

But the reader put forth the following, which I wanted to discuss in more detail. The text in italics is the reader’s view of Microsoft’s “standard” SOA architecture. My response follows in normal text:

 

1. Here is the simplified MS’s “standard” layering,

 

(a) UI Components

(b) UI Process Components [UI never talk to BSI/BC directly, must via UIP]

 

(c) Service Interfaces

(d) Business Components [UIP never talk to D directly, must via BC]

(e) Business Entities

 

(f) Data Access Logic Components

 

I’m aware of its “transaction script” and “anemic domain model” tendency, but it is perhaps easier for integration and using tools.

 

To be clear, I think this portrayal of ‘SOA’ is misleading and dangerous. SOA describes the interactions between separate applications, while this would lead one into thinking that SOA is used inside an application between tiers. I believe that is entirely wrong – and if you pay attention to what noted experts like Pat Helland are saying, you’ll see that this approach is invalid.

 

SOA describes a loosely-coupled, message-based set of interactions between applications or services. But in this context, the word ‘service’ is synonymous with ‘application’, since services must stand alone and be entirely self-sufficient.

 

Under no circumstance can you view a ‘tier’ as a ‘service’ in the context of SOA. A tier is part of an application, and implements part of the application’s overall functionality. Tiers are not designed to stand alone or be used by arbitrary clients – they are designed for use by the rest of their application. I discussed this earlier in my post on trust boundaries, and how services inherently create new trust boundaries by their very nature.

 

So in my view you are describing at least two separate applications. You have an application with a GUI or web UI (a and b or ab), and an application with an XML interface (c, d, e and f or cdef).

 

To fit into the SOA model, each of these applications (ab and cdef) is separate and must stand alone. They are not tiers in a single application, but rather are two separate applications that interact. The XML interface from cdef must be designed to service not only the ab application, but any other applications that need its functionality. That’s the whole point of an SOA-based model – to make this type of functionality broadly available and reusable.

 

Likewise, application ab should be viewed as a full-blown application. The design of ab shouldn’t necessarily eschew business logic – especially validation, but likely also including some calculations or other data manipulation. After all, it is the job of the designer of ab to provide the user with a satisfactory experience based on their requirements – which is similar, but not the same, as the set of requirements for cdef.

 

Yes, this does mean that you’ll have duplicate logic in ab and cdef. That’s one of the side-effects of SOA. If you don’t like it, don’t use SOA.

 

But there’s nothing to stop you from using CSLA .NET as a model to create either ab or cdef or both.

 

To create ab with CSLA .NET, you’d design a set of business objects (with as little or much logic as you felt was required). Since ab doesn’t have a data store of its own, but rather uses cdef as a data store, the DataPortal_xyz methods in the business objects would call the services exposed by cdef to retrieve and update data as needed.

 

To create cdef with CSLA .NET, you’d follow the basic concepts I discuss in Chapter 10 in my VB.NET and C# Business Objects books. The basic concept is that you create a set of XML web services as an interface that provides the outside world with data and/or functionality. The functionality and data is provided from a set of CSLA .NET objects, which are used by the web services themselves.

 

Note that the CSLA-style business objects are not directly exposed to the outside world – there is a formal interface definition for the web services which is separate from the CSLA-style business objects themselves. This provides separation of interface (the web services) from implementation (the CSLA-style business objects).

 


Sunday, June 13, 2004 10:13:35 PM (Central Standard Time, UTC-06:00)
I couldn’t agree more with the points in this blog. Thanks for telling it like it is.

There does seem to be a growing epidemic that is causing people to think of service, specifically Web Services as a layering option inside an application. As pointed out in your blog, this isn’t the case (especially, if you listen closely enough to what the experts are really saying.) Unfortunately, there are a lot of articles, comments, blogs, and even MSDN articles that seem to be giving this misconception, especially in their initial overview or opening statements. As a matter of fact, when I saw the architecture components described by the reader I immediately thought of an MSDN article that I had recently read at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/AppArchCh2.asp At a quick glance of figure 1.0 in the article,“Component layers found in distributed applications and services built with .Net” one might initially get this idea. The diagram does seem to suggest that the business layer is comprised of business workflows, business objects and business entities all topped off with a service interface. It would appear on initial glance that the figure is suggesting that business objects are not to be used directly by the UI Process Components, but only through the service interface, which would probably be assumed by most readers to be a web service. Otherwise, the service interface would not take such an encompassing position in the diagram completely above all the other business objects. The article doesn’t really suggest this (well not completely), but the initial diagram and flavor of the article does. Almost as if this type of suggestion is the current sexy way of selling application architecture.

Another related misconception is that creating web services is just a matter of decorating existing functionality with web method attributes. I hear this statement all the time “well I can just throw a web service around it if I need to”. I even had a recent difference of opinion (well actually an argument) with a system architect on a project that we were both working on in regards to this. The disagreement started when he mentioned that although we were working on an SOA project, he felt that when a business workflow component needed to call upon two different services within our overall application, it would be better for that work flow component to reference the web service assemblies directly and call them in process instead of via a web reference. I can’t believe how many basic misunderstandings were violated in this one statement. My head almost exploded thinking about them. But, I think the basic foundation of this misunderstanding is the idea that exposing something as a webservice is as easy as adding a web method attribute. I almost think that MS made web services a little too easy to build, and as such we are all now suffering through their abuse. Web services and the concepts of SOA (while not necessarily but usually related) have tremendous value and application. However, using them should require a little respect for what they are.
scott
Sunday, June 13, 2004 10:39:37 PM (Central Standard Time, UTC-06:00)
Years ago, in the early 90's when client/server was just getting to be a popular (if widely unsuccessful) concept, I worked with a guy who insisted we were doing client/server work because our VB code was interacting with an Access database that was on a Novell file server. Since we had a "client" and a "server", we must be doing client/server.

Much of the hype around SOA can be attributed to this same physiological phenomenon – this overwhelming desire to be on the cutting edge even if we aren’t really there. It is especially rampant when the terms around the technology are vague and undefined and so it is possible to define things in ways that objectively are nonsense, but subjectively sound really cool :-)
Comments are closed.