The WCF implementation in .NET 4.0 in Visual Studio 2010 meets the needs of beginner, intermediate, and advanced developers
My wife, Joy, and I have an arrangement: I do our business finances, and she handles our personal finances. She keeps track of everything in Notepad files and does all of her calculations using Windows Calculator. I tried to introduce her to Microsoft Excel. I took some of her numbers, placed them on a worksheet, and showed her how she could create formulas to do her calculations, format rows and columns, maintain multiple worksheets in a single workbook, etc. I really thought I had her sold on it. Why would you not want to use such a powerful tool?
The following week, I found her doing our finances... in Notepad... using Windows Calculator. What happened? It turns out that people like simple things. Excel can be simple, but when I showed it to Joy, I made it look much more complex than necessary. I probably should have just showed her how to paste numbers into rows and columns and left everything else for when she was comfortable with the new tool.
What does this have to do with programming? I've found the same factors also affect the adoption rate for Windows Communication Foundation (WCF). My experience, and that of other key influencers in the Microsoft community, shows that while usage of WCF is growing, developers aren't tossing traditional SOAP web services aside as quickly as logic would dictate. Moving to WCF should be a no-brainer. It can do everything that SOAP web services can do. It also performs better and is completely customizable. What gives?
The problem is that although WCF has immense capabilities, too many of them are surfaced too early in the learning process. Therefore, developers who don't absolutely need WCF to get their job done are intimidated and retreat to the safety net of SOAP web services.
The truth is that WCF isn't that hard to start off with. It can be very easy in the beginning and grow in complexity as your project needs require (similar to Excel). The trick is hiding those knobs and dials that you don't need at the beginning, and then making them available as configuration options once you have created a service, established connectivity, consumed the service, and are ready to begin tweaking it to suit. That last part is essential. Just because developers don't want to see the complexity up front doesn't mean that they don't want it available if the situation warrants it. Visual Basic 6 was easy to work with, but you often found yourself boxed into a corner when you reached the edges of its capabilities. That's not what developers want, either.
Microsoft apparently got the memo, and I'm happy to report that the WCF implementation in .NET 4.0 in Visual Studio 2010 is marvelous. The basic XML configuration that gets created for a new WCF service has been shortened from over 30 lines of code to less than 15. A new feature even enables the specification of default bindings and behaviors at the machine or application level. So, a senior developer on your team could define how services will behave, potentially taking your local service configuration down to this:
<?xml version='"1.0'" encoding='"utf-8'" ?> <configuration> </configuration>
No features are being taken away. Rather, Microsoft makes effective use of defaults to simplify the on-ramp to the WCF communication stack. Documentation, as well as blogs, community forums, and tutorials show you how to take your WCF experience to the next level. The difference is that now you can do it on your own timetable when you are comfortable with the basics.
The defaults for WCF are going to give you an experience that's at least as good as the one you get with standard SOAP web services. Only now, when you hit a situation that warrants some customization (e.g., performance tweaking, multiple bindings), you have the capability to roll up your sleeves and dive in. You won't be constricted by limits imposed by the technology itself.
I view the new WCF as being a lot like a car. Most of us just get in, turn the key, and go. You don't have to play with complex stuff under the hood if all you want to do is run to the store for a loaf of bread. Kudos to Microsoft for listening to feedback and coming up with a solution for WCF that meets the needs of beginner, intermediate, and advanced developers. That's much easier said than done.
Jonathan Goodyear (firstname.lastname@example.org) is president of APSOFT, an Internet consulting firm in Orlando. He is Microsoft Regional Director for Florida, an ASP.NET MVP, a Microsoft Certified Solution Developer, and a contributing editor for DevProConnections