Screen-casting my XPath Tester

Dominic said he was preparing a screen-cast of some kind on F#. I love the idea of screen-casting and Dominic’s intention to do something in this area prompted me to have a go myself. What follows is a short (23 second) screen-cast of my XPath tester [138 KB] done with the windows media encoder 9. The red arrow marks the “context node” the expression is being evaluated against. Enjoy. »

Daniel Cazzulino on 'sealed'

Daniel Cazzulino offers some useful advice if you feel you have to seal classes (although from the title of the post I think its easy to see how Daniel feels about sealed in general). If I had to sum it up in one word I’d say “interfaces”. I’m quite fond of interfaces, and I’ve found thinking about your design in terms of interfaces rather than classes to be very helpful because it helps you clearly seperate the essential behaviors and properties of something from the implementation detail. »

Tech-Ed Australia

I’m not going to be at Tech-Ed Australia this year (although working from the North Ryde campus of Microsoft Australia it would be impossible to forget that it is on this week). Readify is well-represented, so good luck with your presentations guys. On the topic of Australian developer conferences it seems that Mitch and Greg have finished finalizing the dates for CodeCampOz ‘Return to Wagga’. I doubt Dominic will be able to make it this year. I wonder if I can convince ‘Yokohama Doug’ to make the journey again? The 6-hr drive will be kind of boring if I’m “going solo”.

Comments

Douglas Stockwell
Sorry Joseph. Like Dominic, I probably wont be in the country :(
11/09/2005 4:36:00 AM

»

VS Custom Text Markers

Some time ago I wrote about how I’d been trying to create some custom text markers in VS 2005. Well, as usual other things came up and I lost interest in drawing little custom glyphs in the margin of Visual Studio. I returned to this this evening because I wanted to add some custom text markers to my xpath expression tester which I’m re-developing as a VS 2005 utility. Previously I’d been able to register my text marker and receive an ID (that I should have been able to use to then go and draw it) but this drawing step always failed. After reflecting on the problem for some time (and with newfound insights re: VS and the dynamic service locator pattern) I decided I needed to focus on registering the object that was going to provide the text markers with VS (since everything else seemed fine). Previously I had done this the way it tells you to do it in the documentation - through  the IProfferService interface. This didn’t work. Tonight I tried a different tactic - using the AddService method of the IServiceContainer interface. That seemed to work (it may call into profferservice underneath…I’m not sure). You can see the results for yourself below. The classic “coding horror” face drawn in the left-hand margin of VS. Not entirely appropriate for XPath but maybe for somebody’s code review tool? The reccomended practice here is to draw something vector-ish so it can scale up to larger font sizes, but the coding horror face is more fun for a demo.

Comments

Jeff Atwood
This is awesome. I also want a VS.NET 2005 add-in that automatically submits code to http://www.thedailywtf.com while you’re at it..
26/09/2005 2:49:00 PM

»

IoC and The Sweet Sweet Taste of Humble Pie

After criticizing Castle’s MicroKernel and Windsor last night for not clearly differentiating themselves from the built-in IoC container in .NET (IContainer) I awoke to a fairly polite smackdown from hammett (now subscribed) of the castle project. Today after reading some new material on IoC, Spring and Castle (and re-reading the stuff I’d read on IoC some time ago) I can see why it probably didn’t occur to the Castle folks to “compare and constrast” with System.ComponentModel. IoC (inversion of control) containers come (for the most part) in two great flavors - dependency injection and service locators. Castle’s MicroKernel and Windsor are (seem to be) the former type - they can inject dependencies into things for you either via the constructor (called constructor injection) or via setter properties (setter injection) which sounds quite useful, and seems to be referred to as “auto-wireup“. System.ComponentModel is more of the second type of IoC container - a dynamic service locator [1]. You can ask for a service of a particular type and the container will provide a service of that type to you if one has been registered. Service locators are very explicit - it is entirely apparent that you’re using this pattern and that services are coming form “somewhere else”. With the former kind the “client“ object is not aware that these dependencies are being injected from a container, they just look like plain ‘ole objects that could have been new()ed up explicitly by a caller and passed in. Because of these fairly fundamental differences it probably didn’t occur to them to compare themselves to the classes in System.ComponentModel.

Picking fights with people smarter than you is great - you always end up learning something

This re-visiting of IoC has been quite interesting. For one I quite like the idea of the different component “lifestyles“ that Windsor provides - Singleton, Transient, Per-Thread and Pooled. To have that kind of “infrastructure“ code factored out of your domain objects sounds extremely useful. Also its bought some clarity regarding the VS object model, another very obvious use of the dynamic service locator pattern. I think I’d like to give Windsor or Spring.NET a try.

[1] - although (just to confuse things) IContainer does inject one thing into IComponets that are added to it - the dynamic service locator ISite. I’ve heard this referred to as “service injection”.

Comments

hammett
You got it. Btw we support the ComponentModel interface as a mean to hide the container implementation from your application - so you can switch off castle in favor of well, something else.

http://svn.castleproject.org/svn/castle/trunk/InversionOfControl/Castle.Windsor/Adapters/ComponentModel/

There is some discussion about that here:
http://forum.castleproject.org/posts/list/14.page

Cheers!
22/08/2005 7:01:00 AM
Mitch Denny
You would think with all controls in a Windows application ultimately implementing IComponent that you could use the service locator pattern to build a quite well integrated application.

But no! When controls are added to the controls collection they don’t get sited correctly. System.ComponentModel is actually broken in so many ways.
22/08/2005 2:13:00 PM

»

Ted Neward -> Ruby on Rails -> Monorail -> Castle Project -> IOC -> WTF?

I like Ted Neward, he frequently posts interesting stuff and is probably as across the .NET and Java worlds as it is possible to be. He’s been causing a bit of a controversy on his new technical weblog by not immediately falling at the feet of Ruby on Rails, the cool web development framework du-jour (as opposed to the cool web application architecture du-jour AJAX. Warning the fusion of these technologies in Ajax on Rails could result in a web development programming fad singularity after which we’ll all have to go back to writing green-screen mainframe applications). Somewhere in the conversation I heard about Monorail, a “rails for .NET”. This sounded moderately interesting to me since (AFAIK) there haven’t really been any attempts to develop “alternate” web GUI platforms on top of the CLR that compete with ASP.NET. I had a brief look at Monorail (formerly called Castle on Rails - more on that in a minute). The intention seems to be to strictly use the MVC pattern to explicitly seperate out the different elements of the application. Interestingly it can use both ASP.NET and NVelocity for templating, so ASP.NET becomes “just another templating engine“. Monorail is part of a larger project called Castle Project which seems to be building a serise of  tools to “speed up the development of common enterprise applications and server applications while enforcing a good design.” (with the apparent focus being working in the .NET world). Aside from Monorail one of the Castle Project’s other “big ideas” is IoC, and they have two IoC containers (one called MicroKernel and one called Windsor…Windsor Castle…get it). Windsor is layered on top of the MicroKernel. After reading through a bit of their documentation I was struck by how much this seemed to duplicate what is already built into the framework in the System.ComponentModel namespace. I really couldn’t see what the “killer feature” that either Windsor or MicroKernel provided over the stuff that is just built right in. This strikes me as a bit of a WTF. Although I CAN see the benefits of a strict MVC architecture (MonoRail) as well as the drawbacks (like throwing out all of System.Web.UI) I was really at a loss as to what these IoC containers provided. Writing stuff for the community is great, but please please please people, if your widget provides something new and compelling compared ot the one that comes in the box then spell it out in an H1 tag in a prominent place on your site. Maybe I just need to refresh my memory on all the IoC stuff and what System.ComponentModel does and does not provide….

Comments

hammett
Hi there,

I didnt know that System.ComponentModel family of classes were capable or auto-wiring components - through inversion of control in a non-intrusive fashion (instead of using IServiceProvider.GetService which is intrusive) and externalize configuration and provide an orthogonal extensibility point where one extension does not impact on others. Is it? If so I can delete all my code from SVN and recall the project :-p

This might help
http://www.codeproject.com/csharp/IntroducingCastle.asp

and these:
http://www.codeproject.com/csharp/IntroducingCastleII.asp
http://weblogs.asp.net/jgonzalez/archive/2005/08/17/422814.aspx

Both are somewhat out dated, but might help ;-)

21/08/2005 3:09:00 PM
JosephCooney
Hmm…..thanks hammett. I wasn’t disputing that your stuff provided something new, just that it wasn’t very well spelt out. In fact I’m still not sure how MicroKernel’s code for aquiring services (from http://www.castleproject.org/index.php/MicroKernel)

ICustomerServices instance = kernel[ typeof(ICustomerServices) ]
as ICustomerServices;

Is all that different from IServiceProvider.GetService (except that your container can take a type or a key). How orthogonal are the features provided by the MicroKernel and what’s in System.CompontnetModel? Perhaps I should have paid more attention to Windsor and less to the MicroKernel. I’m quite fond of configuration-driven factories which seems to be something Windsor uses a great deal.
21/08/2005 5:00:00 PM
JosephCooney
OK - I think I’m starting to understand where and why auto-wireup might be quite useful. I’d still be interested in seeing a write-up on how and why this type of IoC container is better/different to System.ComponentModel
21/08/2005 5:29:00 PM

»

Just finished installing Apache - or - further evidence that I might be a communist

I’ve been called a communist already on my current project for making Firefox my default browser (I guess my current project is for Microsoft, so they might be biased). To add further fuel to the allegations of rampant communism I just finished installing Apache on my laptop…what gives? Am I giving up System.Web.IHttpHandler for some Perl and duct-tape? Not likely. The reason I set up Apache was for Subversion. My Subversion repository is hosted on my laptop, but at the moment I’m doing most of my “work” (as in fun at home out of hours mucking around with stuff work) inside VPCs. When you’re doing everything locally using a file:// based URL to your subversion repository is fine, but when you’re in a VPC you either end up copying files between the host system, or using file shares between the two, meaning less commits and more chance of losing work. My intention from the outset was not to install Apache (subversion can leverage the web-dav stuff in apache to make your repositories available via HTTP, and this is kind of the default setup for subversion in a networked environment). I thought Apache would be more “heavy weight” than the other alternative - a lightweight service/daemon called svnserve that is included with SVN. Alarm bells should have started going off when I noticed in the SVN FAQ that to run as a service under windows you need to run SVNServe inside a seperate EXE like this one (which is not part of the “standard“ SVN windows install). Hmmm…sounds like I might be wandering off the well-trod path of easy painless version control. After a little while setting this up (looks like the path to the repository should NOT end with a / character) I was able to get stuff from my repository remotely, but unable to update (after several Reads of The Friendly Manual). This was a little disappointing since it was the first time since I started using Subversion about 2 years ago that it hasn’t “just worked”. I could have probably persevered for longer with this, but I’ve run Apache before so I was not too afraid of setting it up. Much less time later I have Apache 2 up and running, and mod_dav_svn serving up my subversion repository to VPCs and anybody else on my local subnet. I’d be interested to know how other people run their version control systems in mult-machine virtual environments. VSTS is going to be too heavy-weight…WinCVS works but….SourceSafe is not something I would ever voluntarily use….SVN looks like a good option here.

Comments

Scott Baldwin
I too have a soft spot for FireFox…. Comrade.

Interesting about subversion, I was getting close to this point myself, although I think I’ll stick with file shares for a little longer.
18/08/2005 4:50:00 PM
Richard Mason
I’ve got svnserve running here at plas as a service no probs. Just used srvany and no problems…
5/09/2005 7:43:00 PM

»

Biztalk Wrangling: a tale of the disappearing messages and the competing consumers

Mitch’s reminder to himself regarding Biztalk pipeline components in turn reminded me of a humorous situation the other day at work. Its long, a little involved and not that funny so here goes….  The development environment The environment for the current project is pretty well set up on the whole. Each developer has a nicely spec’d Windows Server 2003 box with all the servers etc set up and running. Each night we do a build that is automatically migrated to the testing system for the automated functional and performance tests to run against, and for manual testing the following day. »

SushiDisk!

Dominic sent me a super-cool birthday present which arrived today. Yes, a sushidisk! A piece of “japanese traditional USB memory” from SolidAlliance. They have a whole range of very edible looking USB memory as well as this great USB extension cable/plate, USB “ghost detectors“ and USB rubber ducks.  I got one of these very edible rolls shown below (sans plate). The salmon roe looks delicious! Luckily the packaging warns me this is “uneatable“. »