Seeing the Forest AND the Trees

Technology for a better world.

WCF Impressions: Separation of Concerns March 23, 2008

Filed under: .NET,WCF — pdxbob @ 12:57 am

Someone at my company’s recent developers conference pointed out that a key tenet of WCF is separation of concerns. So let’s explore what this means. WCF allows you to write services, whether they be “web services” or “queueing services” or whatever type of service you need. A service is some code that you write as part of a typically larger system. The service will be consumed by another program residing anywhere you choose to expose it: on the local machine, across a LAN, over the web, etc. When you conceive of a service, you want to think about (1) what the service will do, (2) where it will be called from, and (3) what constraints (e.g., performance, security) to put on the service. Prior to WCF, .NET allowed you to create an ASP.NET web service, also called an ASMX. The developer still had to think about those three questions mentioned above but they also had to code, in the service class/method code, all of the details related to how the service would be implemented for performance, security and who could be a consumer (who in the general sense). WCF separates out these things into configuration files so that, in the process of writing the service code, you can just concentrate on what the service will do. How the service is called, how performant and secure it is, these can be defined in configuration.

Why is this so important? Say you want to expose a service to both a customer through a well-known web page interface, but you also want to expose the service to an administrative WinForms or console program running on a local LAN. Security considerations are likely to be different and knowing that the admin program is running on the LAN is also likely to influence how the service can be most efficiently called.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s