I’ve been wanting to work with WCF for a fairly long time. I suppose I could have flirted with burnout and done it on top of my daily paying activities, but I like to think my health’s improved with not doing this kind of thing. In any case, suddenly a paying client has a requirement for a REST-based set of services, and I thought it’d be nice to try this with WCF for a couple of reasons:

  1. I always liked REST (die, SOAP, die) and have rolled my own more times than I’d care to mention
  2. WCF has an almost shiny, nearly-new REST Starter Kit

I’ve seen enough about WCF to know that I like the separation of contract from implementation and I thought I’d be able to get a good idea of whether it did enough of the following to make the effort invested in a “starter kit” with no go-live license worthwhile: -

  • Authorization / API key implementation (check – one sample project has an interceptor-based solution)
  • Serialization to XML and JSON (check – it’s baked right into the kit when you implement a collection service base)
  • Error handling and presentation (half a check – nice and RESTful, with a nice WebProtocolException that lets you tailor what just happened to the most appropriate HTTP status code, but I would like more control over what gets rendered back)
  • Documentation/discoverability (half a check – there’s a nice .../help URL based on standard WCF contract/member attributes but there’s no WADL. Did we need it anyway?)
  • General syndication support (check, thank you SyndicationItem)

In any case it all looks terribly promising. The templates are good, the screencasts are good … hang on, wait – Aaron Skonnard’s screencasts are mucking about with a Service.svc.base.cs file I don’t have, and that’s how he’s customising the output XML. That’s not in Preview 2. Suddenly I find that this stuff’s moved into Microsoft.ServiceModel.Web and I can’t edit it any more. So the customisation story must have moved. Then I discover that the way to customise is apparently to move the source code into your project and change the namespace so it doesn’t conflict with the existing ServiceModel. Woah. That’s not even as nice an “extensibility point” as we had in Preview 1… oh well. So I’m stuck with ItemInfoList and ItemInfo in my output XML. Suddenly the lack of the aforementioned go-live license doesn’t seem so bad. I wouldn’t be able to use this as it is now.

So this leaves me in quite an odd place – clamouring for half of a very promising toolkit that just isn’t quite finished and which I wouldn’t be legally allowed to use anyway. However, the source code appears to be all there. And we need a REST strategy really soon. Not to denigrate the excellent effort from the MS REST team, but it’s at times like this you wish the effort you’d just put in had been directed at an open source project – at least you’d have somewhere to go, even if you had to pedal that last mile yourself. I’ve been titillated and subsequently frustrated – I’m not allowed to touch, as the chaperone’s an army of lawyers.

Looks like I’ll be rolling my own again.

EDIT: Hmm, I might have been a bit hasty – there’s plenty in WCF 3.5 as it stands to build REST services. Just not quite as easily. I’ll miss WebProtocolException and I’ll miss having the zero-config approach. I might also miss the interceptor-based auth and the in-built help generation. But it’s still doable, if just somewhat harder…

NB – this has sat in my “you didn’t publish this, doofus” folder for some time now. It still seems relevant, so here – for the benefit of my three readers – it is:

A confession – I’ve come to the multi monitor thing rather late. For five years or so I’ve been getting by on a 1280×1024 LCD like everyone else, and since I’m freelance I work in a lot of places where you’re lucky if you get that. Most of the time you can expect an old 17″ monitor that looks like it was smeared in fruit-based conserve (or worse, the core dump of a baboon – I’ll spare that particular company a mention, though I do hope their erstwhile IT Guy has discovered his shower – or at least toilet paper – by now). As a result, given the usual small constellation of developer apps you’ll have open at any one time and their natural predilection for consuming what the entire software development industry has, irony-free, come to call “real estate”, I’ve become deft with ALT-TAB, CTRL-TAB, CTRL-F6, SHIFT-CTRL-F6 and ALT-CTRL-SHIFT-FN-pasa doblĂ©-reverse triple somersault with pike. Quite a lot of people (alright, one that I know of) will state their preference for some other kind of window manager shoehorned into XP at this point, and probably with good reason, but the aforementioned freelance status means it behoves you to learn to cope with default tools before coming to rely on yet another thing you’ll just have to set up at the start of your next gig.

Anyway, just recently I’ve been working at a place where multi-monitor setups are the norm and despite my previous reluctance to come to rely on something that may not be there at that next gig, I’ve rather taken to it. In a limited sort of way, at any rate – I might only use the second monitor for having a browser open for reference, or a query window, or perhaps a Terminal Services session (though this last one is less likely since the TS client’s support for multiple monitors, especially when those monitors are of a different resolution and/or aspect ratio is, to put it charitably, absent).

The thing that really struck me is that my cognitive load is immediately lightened. Those with a background in psychology (and even those with only a passing interest) will no doubt be acquainted with George A. Miller’s magical number seven, plus or minus two – the idea that we have between 5 and 9 short term memory “slots” available to us. Not having to ALT-TAB or task switch using the task bar frees me from needing to remember where I left a program I haven’t used for a minute or nine.

As a developer, anything that gives you back one of your 7 +/-2 short term memory items is invaluable. Software development is a constant assailment of our limited mental faculties by almost overwhelming detail, and we constantly have a little “stack” of our own: can’t do x until y is complete, can’t do y until z and b are complete, b is awaiting consent from Harry in ops and we can’t do z right now because it’s lunchtime. And multiple monitors really do help with this (although they can’t nip out and get you a chilli beef ramen). I’ve seen it said by Scott Hanselman that: -

You just can’t have enough screen space. Any space in front of your face that isn’t a working monitor but is still in your field of view is a waste if it’s not conveying information.

I’d hesitate to go that far – the biggest benefit in terms of order of magnitude for me has come with going from one to two. I suspect three would increase that benefit, but not to the extent that going from one to two did, and anyway, you do have to remember not to hit DEL indiscriminately when your cursor is on a physically different monitor.

So, given that we have a Very Small Brain and Very Large Problems which require Looking At Lots Of Stuff at once, may I suggest a trusted old tool which has been available for a good number of years now and which provides a handy way of viewing lots of pertinent information in a persistent, multipage readable form and which will be available at any modern desk at which you might find yourself sat? It’s the good old pencil and paper (or pen and paper, should you be the kind of super being who never makes mistakes). This all leads nicely on to the next article I’ll never write, in which I take to task every single developer who doesn’t use them - Less Coding, More Thinking.

© 2014 ZephyrBlog Suffusion theme by Sayontan Sinha