Good layered architecture with validation and LINQ (+ WCF?)

  • Thread starter Thread starter Evert
  • Start date Start date
E

Evert

Does anybody have a good example/guide for using LINQ in a layered
architecture with maybe WCF?

Thanks in advance,

Evert
 
Evert said:
Does anybody have a good example/guide for using LINQ in a layered
architecture with maybe WCF?

It's in general not good practise to use a service as a tier. Services
are standalone applications, so should be seen as vertical slices of
your application, not horizontal slices of your application.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
Can you explain me why a service is not a Tier? What do you mean with
horizontal and vertical? is there a good site which explains this?

Thanks in advance,

Evert
 
It's in general not good practise to use a service as a tier.
Surely WCF is precicely that though; an abstract bridge between
(generally physical/horizontal) tiers For instance, a smart-client
using WCF to access data from a WCF service over (typically) http.
Perfectly normal and indeed the textbook use-case.

For specific scenarios, this does exist - but in quite controlled
scenarios - google for "LINQ to Amazon" for example; not WCF, but a
similar fundamental principle - but it takes a lot of plumbing code.
http://weblogs.asp.net/fmarguerie/archive/2006/06/26/Introducing-Linq-to-Amazon.aspx

In the more general sense, I know what the OP is asking for (something
akin to a data-context for a WCF interface), and unfortunately I
haven't seen anything that really fills that gap - but the biggest
barrier is that LINQ really works within a logical (vertical) tier
where you can just about get away with allowing ad-hoc (i.e. not
formally defined up-front) queries, since you are in the same column.
It doesn't work well accross physical (horizontal) tiers, where you
normally want to have well-defined interfaces. That said, the REST
offering in 3.5 may offer some interesting possibilities, since that
is a bit less formalised (allow for better composability); but a
double edged sword...

Marc
 
Evert said:
Can you explain me why a service is not a Tier? What do you mean with
horizontal and vertical? is there a good site which explains this?

Vertical means that you have a full application with layers which has
an interface you can utilize as a service. Horizontal means that you
have a layer in your application which happens to be consumable as a
service.

The downside of horizontal usage of a service is that you have a lot
of data-traffic between tiers in formats which are used internally in
your application. In short: it's very inefficient.

Services should be seen as standalone applications you're utilizing in
your application. See these presentations by Gregor Hohpe:
http://www.infoq.com/presentations/hohpe-soa-development
and
http://www.infoq.com/presentations/hohpe-soa-conversations

I'm sure after the first one, you'll understand what I mean :)

FB

Thanks in advance,

Evert

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
Marc said:
It's in general not good practise to use a service as a tier.
Surely WCF is precicely that though; an abstract bridge between
(generally physical/horizontal) tiers For instance, a smart-client
using WCF to access data from a WCF service over (typically) http.
Perfectly normal and indeed the textbook use-case.


'tier' in general means horizontal layer, not vertical pillar.

See my links in the other post :)

FB


--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
'tier' in general means horizontal layer, not vertical pillar.

Actually, I'd commonly call that a "layer", not a "tier" (and yes, I
know the words are broadly the same in English); indeed, the
traditional "3-tier" is often assicated with 3 different physical
platforms, hence horizontal not vertical.

But in truth; all the terms are often horribly confused and abused;
hence I disambiguated (and perhaps over-simplified) by referring to
the physical and the logical; most people can agree that the client
and server are generally different physical platforms - although even
this is not a prerequisite.

And as you say, what works well in one axis doesn't work so well in
the other; we could discuss the semantics all day, but to restate:
LINQ won't generally work over the physical boundary* that should be
the worst-case assumption with WCF; it can, however, be made to work
within the components of a single vertical chunk of components.

Marc

(* and here, once WCF has done the lifting for us, it isn't the
"physical" that is key, but "boundary": we want structured,
well-defined interfaces between those vertical chunks)
 
Services should be seen as standalone applications you're utilizing
in
your application. See these presentations by Gregor Hohpe:
[links to some SOA presentations]

Now, if only we (at large) could agree on a single interpretation of
SOA ;-p
 
hence horizontal not vertical.
or do I mean vertical not horizontal?
"things that are arranged vertically, and have the same horizontal
reference"

I'm managing to confuse all 3 of us now... more coffee...

But if you can see past my random word swaps, I think I have a
sensible point in there somewhere... probably well hidden...
 
Marc said:
Services should be seen as standalone applications you're utilizing
in your application. See these presentations by Gregor Hohpe:
[links to some SOA presentations]

Now, if only we (at large) could agree on a single interpretation of
SOA ;-p

Hehe, that would indeed be a first ;). Just imagine if such an
agreement would arise... how many book publishers would go out of
business, eh? ;)

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
Just to add a thought; perhaps Astoria is the answer here? Currently
CTP, but it seems to offer much of what you are talking about...? I
haven't had time to play with it yet, though...

Marc
 
Back
Top