Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Edit 2010-11-27; clarified my thoughts, which was really needed.</p> <p>A web service exposes functionality across different types of applications, not for abstraction in one single application, most often. You are probably thinking more of a way of encapsulating commands and reads in a way that doesn't interfere with your controller/view programming.</p> <p>Use a service from a service bus if you're after the decoupling and do an async pattern in your async pages. You can see Rhino.ServiceBus, nServiceBus and MassTransit for .Net native implementations and <a href="http://www.rabbitmq.com/" rel="nofollow noreferrer">RabbitMQ</a> for something different <a href="http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/" rel="nofollow noreferrer">http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/</a>.</p> <p>Edit: I've had some time to try rabbit out in a way that pushed messages to my service which in turn pushed updates to the book keeping app. RabbitMQ is a message broker, aka a MOM (message oriented middle-ware) and you could use it to send messages to your application server.</p> <p>You can also simply provide service interfaces. Read Eric Evan's Domain Driven Design for a more detailed description. </p> <p>REST-ful service interfaces deal a lot with data, and more specifically with addressable resources. It can greatly simplify your programming model and allows great control over output through the HTTP protocol. WCF's upcoming programming model uses true rest as defined in the original thesis, where each document should to some extent provide URIs for continued navigation. Have a <a href="http://codebetter.com/blogs/glenn.block/archive/2010/11/01/wcf-web-apis-http-your-way.aspx" rel="nofollow noreferrer">look at this</a>. (In my first version of this post, I lamented REST for being 'slow', whatever that means) REST-based APIs are also pretty much what <a href="http://wiki.apache.org/couchdb/HTTP_view_API" rel="nofollow noreferrer">CouchDB</a> and <a href="https://wiki.basho.com/display/RIAK/Building+a+Development+Environment" rel="nofollow noreferrer">Riak</a> uses.</p> <p>ADO.Net is rather crap (!) [N+1 problems with lazy collection because of code-to-implementation, data-access leakage - you always need your db context where your query code is etc] in comparison to for example LightSpeed (commercial) or NHibernate. Spring.Net also allows you to wrap service interfaces in their contain with a web service facade, but (without having browsed it for a while) I think it's a bit too xmly in its configuration.</p> <p>Edit 1: With ADO.Net here I mean the default "best practice" with DataSets, DataAdapter and iterating lots of rows from a DataReader; it breeds rather ugly and hard-to-debug code. The N+1 stuff, yes, that is about the entity framework.</p> <p>(Edit 2: EntityFramework doesn't impress me either!)</p> <p>Edit 1: Create your domain layer in a separate assembly [aka. Core] and provide all domain and application services there, then import this assembly from your specific MVC application. Wrap data access in some DAO/Repository, through an interface in your core assembly, which your Data assembly then references and implements. Wire up interface and implementation with IoC. You can even program something for dynamic service discovery with the above mentioned service buses, to solve for the interfaces. WCF uses interfaces like this and so do most of the above service busses; you can provide a subcomponentresolver in your IoC container to do this automatically.</p> <p>Edit 2: A great combo for the above would be CQRS+EventSourcing+ReactiveExtensions. Your write-model would take commands, your domain model would decide whether to accept them, it would push events to the reactive-extensions pipeline, perhaps also over RabbitMQ, which your read-model would consume.</p> <p><strong>Update 2010-01-02 (edit 1)</strong></p> <p>The jest of my idea has been codified by something called MindTouch Dream. They have made a screencast where they treat almost all parts of a web application as a (web)-service, which also is exposed with REST.</p> <p>They have created a highly parallel framework using co-routines to handle this, including their own elastic thread pool.</p> <p>To all the nay-sayers in this question, in ur face :p! <a href="http://blog.developer.mindtouch.com/2009/11/05/mindtouch-monospace-going-concurrent-keeping-your-sanity/" rel="nofollow noreferrer">Listen to this screen-cast,</a> especially at 12 minutes.</p> <p><a href="http://developer.mindtouch.com/Dream" rel="nofollow noreferrer">The actual framework is here.</a></p> <p>If you are into this sort of programming, have a look at <a href="http://www.reddit.com/r/programming/comments/64th1/monads_in_python_in_production_code_you_can_and/c02u9mb" rel="nofollow noreferrer">how monads work</a> and <a href="http://blogs.msdn.com/wesdyer/archive/2008/01/11/the-marvels-of-monads.aspx" rel="nofollow noreferrer">their implementations in C#</a>. You can also read up on <a href="http://en.wikipedia.org/wiki/Coroutine" rel="nofollow noreferrer">CoRoutines</a>.</p> <p>Happy new year!</p> <p><strong>Update 2010-11-27 (edit 2)</strong></p> <p>It turned out CoRoutines got productized with the task parallel library from Microsoft. Your Task now implement the same features, as it implements IAsyncResult. Caliburn is a cool framework that uses them.</p> <p>Reactive Extensions took the monad comprehensions to the next level of asynchronocity.</p> <p>The ALT.Net world seems to be moving in the direction I talked about when I wrote this answer the first time, albeit with new types of architectures I knew little of.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload