New Posts New Posts RSS Feed: Cocktail on the server
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Cocktail on the server

 Post Reply Post Reply
Author
JohnBloom View Drop Down
Groupie
Groupie
Avatar

Joined: 30-Nov-2010
Location: Topeka, KS
Posts: 95
Post Options Post Options   Quote JohnBloom Quote  Post ReplyReply Direct Link To This Post Topic: Cocktail on the server
    Posted: 04-Oct-2012 at 7:27am
First let me state that I know that cocktail is a client side framework. I am not looking to use Cocktail on the server I just feel like there is not a lot of talk about best practices for the server. 

We use a lot of third party libraries that are written in .Net. We use rpc to make calls to these libraries or we put them in a windows service and save records in a db to trigger them. On the client I am very confident about how to organize code and use the repository model and unit of work but on the server things are getting a little sloppy.

I used to think that this topic was beyond the scope of cocktail because cocktail is a client side framework and designed to run asynchronously while the server is synchronous. Then I watched John Papa's SPA video and there he was implementing a cocktail like framework on the server and it looked pretty good. I could see Ward Bell/Ideablade influence through the whole video. It seems the Cocktail design principles are gaining traction. John, however,  had implemented it on the server synchronously. 

This brought up questions in my mind again. What is cocktails answer for the server? How should we be organizing our code on the server and in services where there is no need for async but a still prevalent need for organization and code reuses? Why am i confident on the client but not so much on the server?

What are your thoughts?

Thanks for you work on this project Marcel we rely on your advice a lot and it is nice to see people like John Papa creating cocktailesque applications. 
-John Bloom
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 04-Oct-2012 at 3:35pm
John,
Many of the concepts in Cocktail are very much at home on the server, especially repositories and unit of work as a whole. For services you would implement them synchronous, but for business processes running on the server they could be asynchronous. For example a client could start an asynchronous process on the server via a service or server method call and when the process is done, the server could notify the client via something like SignalR.
 
There are considerations on the server that differ from the client. The server environment is inheritly multi-threaded. Each request comes in on it's own thread. That means things like the MEF container must be created per request and disposed at the end. Similar consideration must be given to authentication and authorization as the server is also inheritly multi-user, processing requests from different users concurrently.
 
At the moment there is no server version of Cocktail, but pretty much everything starting from the unit of work could technically have server specific implementations.
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down