WCF/WF - when to move the functionality from a class(.cs/jsp/php) to a service(web service /wcf)?

Asked By karur krishna madhu on 13-Jun-13 01:57 AM
when to move the functionality from a class(.cs/jsp/php) to a service(web service/wcf) ? How to identify the scope of that requirement?
Robbe Morris replied to karur krishna madhu on 13-Jun-13 04:35 PM
never...

If you have logic that is not directly related to supporting the drawing of controls (html or otherwise) and you think has a remote chance of being used elsewhere, stick that logic in classes in a separate assembly.

Then, you simply reference that dll in your ASP.NET project.  If at some point in the future, you want that logic available via the WCF service, you reference that same assembly and put only the minimum amount of code in the web methods or stubs in the WCF service to call that same set of logic.

On paper, a lot of guys will create architectures that "always" call logic like this via a web service because it looks good in a diagram.  They pay no attention to the extra resources to make those logic class via IIS when it isn't necessary or prudent.

Design stuff that is fast and doesn't break.  Your end users couldn't care less how your architecture looks on paper.
karur krishna madhu replied to Robbe Morris on 17-Jun-13 02:18 AM
Thanks morris! you have spill the beans :)
karur krishna madhu replied to Robbe Morris on 20-Jun-13 02:38 AM
Hi Morris,
You had said that we should never move the functionality to a service. the reason "They pay no attention to the extra resources to make those logic class via IIS when it isn't necessary or prudent" what are the cons of this and what resources come in to picture? could you please elaborate it. In that case every  this should be called using a dll(Dll can be called irrespective of any programming language of .net) then why do  we write the huge lines of code in service class file ? why dont we invoke the same using a dll reference?
Robbe Morris replied to karur krishna madhu on 20-Jun-13 08:18 AM
Let's be clear, I never said never call this logic from a web service, I said never put the logic in the web service assembly itself.  There are clearly times when it is best to call the same logic directly in your ASP.NET app "and" expose it to outside clients via web services.

The point I was trying to make is that say 80% of the calls to that logic are going to come from your ASP.NET app users server side, then make the call directly without the overhead of making an http call to another IIS site or even perhaps another server.
karur krishna madhu replied to Robbe Morris on 21-Jun-13 05:43 AM
i apologize for misinterpreting the statement. Thanks morris