• Deep indentation is still bad and wrong.

    I wrote a while back about how indenting trailing lines of code to match some semantic element of the line above was bad and wrong - it's inconsistent and hard to maintain, not to mention hard to get right initially and generally makes code harder to read unless you have a very wide screen. Continue reading...

  • RabbitMQ in .Net

    With help from Ann, I did some simple demo programs over the last few months to try to understand RabbitMQ and message queues in general.

    The code that we produced, (with a readme document) is here on github

    RabbitMQ is a free, open-source cross-platform message queuing system. It is described as robust, fast and scalable though I didn’t really test those features since I just ran it on my laptop and sent a few tens of messages. In production it would run on a server, or on a dedicated cluster if a really large volume is required. It follows a standard called AMQP.

    Continue reading...

  • Ioc Comparison: Autoregistration in Autofac

    Autofac is a capable and interesting IoC container. I  looked at Autofac for basic IoC here. Implementing my suite of autoregistration tests in Autofac did not require any custom extension classes, autofac handled everything that I asked of it.

    Autofac adds registrations in an atomic manner, like StructureMap. But Autofac doesn't use lamdbas - you configure a ContainerBuilder in as many steps as needed, and then create a container from this builder in a single operation.

    Continue reading...

  • IoC comparison: Autoregistration in StructureMap

    The StructureMap IoC container has guidance on using Autoregistration which I followed. Earlier I put StructureMap through its paces for basic IoC.

    For Autoregistration, StructureMap uses lambdas, even nested lambdas. The interface is not fluent. The basics are quite simple. StructureMap feels a bit like Ninject under the hood, and there are similarities – both do automatic resolution of unregistered types, and both need custom code to do more complicated Autoregistration scenarios. Both are perfectly usable with a bit customisation.

    Continue reading...

  • IoC comparison: Autoregistration in Ninject

    The Ninject IoC container has an extension that does autoregistration, or "Convention based binding" as they call it.  I have looked at basic IoC in Ninject before, and I quite like it. Autoregistration is not a third party add-on, but is part of the ninject source tree here on github. Ninject autoregistration does not work in quite the same vein as Windsor or Unity's fluent interfaces, but it feels like the "Ninject way", i.e. similar to the other parts of ninject such as using classes as modules.

    Continue reading...

  • IoC comparison: Autoregistration in Microsoft Unity

    The Microsoft Unity container does not include autoregistration, so you could do without it, roll your own or use the Unity Auto Registration addon by Artem Govorov. This post looks at Unity with this addon. Like Windsor's autoregistration API, it also uses a fluent interface. Unity's fluent interface starts with the extension method ConfigureAutoRegistration, then follows one or more Include(FilterPredicate, Then.Register.As… ) blocks, and ends with ApplyAutoRegistration();

    Continue reading...

  • IoC comparison: Autoregistration in Castle Windsor

    Castle Windsor emphasises autoregistration, probably more than any other .Net IoC container, and the API to do it is probably the most complete.

    Windsor's explicitness about registration - the lack of automatic resolution of unregistered concrete types - turns out to be an asset with autoregistration. In a sense, automatic registration and automatic resolution are two different approaches to the same problem of convention over configuration in that they allow you to create types without mentioning them in the container configuration. But they don't play that well together, and can give confusing results.

    Continue reading...

  • IoC containers: Autoregistration tests groundwork

    I have put together an assembly containing some types used to test the autoregistration features of different Inversion of Control containers.

    I will put some IoC containers (starting with Windsor) through a set of tests over these classes. The IoC container will have to find a concrete class, find an implementation for an interface, and find all implementations of a interface where multiple types implement it.

    Continue reading...

  • IoC containers: an introduction to Autoregistration

    I attended a talk by Krzysztof Kozmic at NDC2011 on IoC container patterns and antipatterns. Krzysztof contributes to the Castle Windsor IoC container, so it centered around Windsor. 

    I specifically want to talk about autoregistration, since this was a major topic of the talk, and is a best practice (at least it is in Windsor) and one that I have been gearing up to cover.

    Continue reading...

  • Agile after NDC 2011

    I attended a couple of Agile talks at NDC2011. Particularly there was Michael Feathers' "The Mistake at the Heart of Agile" and Scott Belware's "Beyond Agile" The first of those was well covered by Gojko Adzik over here, in short saying that the software development that is managed via scrum needs to grow closer to the other functions of the business, not isolate itself from it. Continue reading...

  • IoC comparison: OpenRasta Internal Dependency Resolver

    OpenRasta is an excellent .Net web framework written by Sebastien Lambla. OpenRasta is open source, is opinionated about REST, but is also highly flexible and configurable. So you can plug any Inversion of Control container into it, but it also contains a basic built-in IoC container that is used if no external container is supplied. Even though this container is not intended for use outside of OpenRasta, I decided to isolate it and put it through my IoC comparison tests.

    Continue reading...

  • Debugging orchard themes

    An orchard theme is a website with content, scripts, and styles; and views as .cshtml files. These are html with c# code embedded via the ASP NVC razor markup. I find these easy to change, but without running it, I also make mistakes, and one typo in the cde can prevent the whole site from running. So, running it in Visual Studio and debugging it is necessary. I did it like this:

    Continue reading...

  • Orchard 1.1 after a few days

    Orchard is a full CMS not just a blog engine, but as a blog engine the 1.1 release is growing on me. It has come a long way since the betas, and proably has even further to go. But I can see it growing up to be like WordPress. I tried a few things out, and I'll be keeping it.

    Continue reading...

  • IoC comparison: Spring.NET CodeConfig

    Spring.NET has a new add-on called Spring.NET CodeConfig 1.0.1 that I hoped may adress some of what I saw as spring’s shortcomings in my comparisons of .Net IoC containers, specifically it should allow different configs be used in different tests in the same project. The docs for Spring.NET code config are here. it's also on github and nuget and is apparently just "the first step in the process of expanding Spring.NET's support for non-XML-dependent configuration scenarios". It works,  and goes about it in a different way which is not as terse and as most other containers.

    Continue reading...

  • Upgrade to orchard 1.1

    Orchard 1.1 looks pretty slick, but also pretty complex.

    However the upgrade did not go smoothly at all - before upgrading the site I attempted to install the latest version of the BlogML module, with which to take a backup. The only effect was to totally break the site - yellow screen on any URL. So, a bit of recent data has been lost. This is painful, but I will see what I can recover.

    Continue reading...

  • Remote wipe - Why my new phone won't be connected to my work mail

    I've been enthusiastically tweeting about and from my new Google Android Nexus S phone. It's a lovely little phone with so much inside it. I felt that shiny-new potential way about the G1 running Android 1.5 when I got one about 2 years ago, too. Now it seems so dated and clunky in comparison. Such is the pace of change.

    One software feature, I think, is badly misdesigned. This handset is my personal phone, which I have bought and paid for. But it would help to be able to read work emails on it from time to time. The 2010 iteration of Outlook Web Access is slick, but a native mail client is prefereable. So I entered the exchange server mail details into the email app, but stopped at a dialog asking me if I wished to accept the mail administrator's security control over the phone.

    Continue reading...

  • How to package up files with OpenWrap

    OpenWrap can be easily used to package up .Net projects, but it can also be used to package up any files that you want it to. I tried to do this for  testing purposes, but it's useful as a general file distribution process – i.e. how many computers can be kept up-to-date with the same versions of a set of files, be they a web app made of .html, .css and js files, a desktop application made from .exe and .dll files, or whatever.

    I spent a few hours working out how to do this, resorting finally to reading the documentation. Here are the step-by-step details of what I came up with.

    Note this example assumes that you have, for the sake of example, a folder called C:\Code\ORTest\Content containing the content files that you want to publish, in this case a file HelloWorld.txt containing the traditional text "Hello, world." and that you wish to make a repository at C:\Code\ORTest\Repo. If you wanted to get these files to several machines, you would make this repository on a \\server\share folder, but a local folder will do for testing.

    This also assumes that you have OpenWrap installed, and o.exe is available at a command prompt.

    Continue reading...

  • Open letter to Amazon

    Dear Amazon.

    You know me. I don't mean that an Amazon employee reading this knows me, but Amazon as a company, as a database, as an corporate entity that breathes data knows me well. I'm a regular customer, I'm in your files. I like shopping with the Amazon UK website. You get so many things just right. As you know better than I do, I come back and I spend money with you almost every month. I've even purchased and sang the praises of your kindle e-reader.

    For once, I am deeply disappointed in you. This is because of your decision to sever your hosting with Wikileaks.

    Continue reading...

  • Duplicate finder

    A while back (2007) I was challenged to make a duplicate code detector for C#. Simian  did a valuable job, but cost money. And, someone said to me, how hard could it be? So I wrote one and put it here. I wrote about it here and here.

    I learned these things about the problem of detecting duplicate code:

    Continue reading...

  • Putting people in little boxes

    I am a sceptic about tests that attempt to classify people as an "Introverted intuitive Thinking Perceiving" personality or "Visual Learners"

    I think that these are fun toys, but shouldn't be taken too seriously.

    Continue reading...