Anthony Steele's technical blog

  • jQuery is the new codebehind

    Remember this code? You probably don't.

    procedure TForm1.Button1Click(Sender: TObject);

    begin

    // code goes here, maybe read a file

    end;

    It's the code that handles the click of a button on a form in Borland Delphi, which was one of the best way to make windows programs in the mid and late 1990s. The main problem with the "code goes here" part is what code, how much code, and how do you organise it as it grows. Managing complexity is the usual problem in coding. If there are several buttons, do they call common methods or is it cut-and-pasted? (we quickly learned that this wasn't the best idea ever).

    Continue reading...

  • Simple and complex type systems, and JavaScript

    Javascript. It won't go away. Like many coders who are experience in compiled, strongly typed languages, my accommodation to JavaScript has been slow. 

    One thing that I have learned from JavaScript is about other languages - how the complexity of type systems feeds on itself. I mean this:

    Continue reading...

  • Returning to multiple exit points

    My blog post on multiple returns and why they are actually quite useful has a small but enduring popularity (some of it negative) among those who obsess over minutia. Yes, that includes me sometimes.

    For instance this blog post, which argues for single returns, with an example where a single return is better.

    Continue reading...

  • Introverts in Agile

    There has been talk recently about introverts and extroverts in software development, on the back of Susan Cain's book "Quiet: The Power of Introverts" and her TED talk. This topic has been around for a while - It may look new but it's actually come around again. Continue reading...

  • Android app permissions - why is it all or nothing?

    I like my android phone. My Nexus S is now running 4.0 ICS for a few weeks now, and it's great. It looks more "authentically digital" than the 2.3 OS, and more like Windows phone 7. One problem, it took me 2 weeks to work out how to pick up an incoming voice call, but hey, who does that a lot on a phone any more?

    What's wrong with this little free app that draws some graphs? It gets data from a server. And it asks for permission to "make calls, costing you money". Say what? Doesn't that look like a premium rate scam?

    Continue reading...

  • CSS Grids

    I wrote about the css grids proposal, and why it's badly needed. It's a bit of a rant, and for a change I posted it as an answer in stackoverflow instead of here. I expect that the way that people find it, interact with it and react to it will be different, and we’ll see how that experiment works out. I feel that it benefits from being positioned amid a whole lot of questions which are the debris of people struggling to achieve grid-like layouts using existing css constructs. Actually I said "stupid css hackery that needs to go away", wondering a bit if anyone would disgree. Continue reading...

  • IoC containers considered useful

    Rob Ashton recently posted that he doesn't like using IoC containers. I've written about Ioc Containers a fair bit. I like Rob's post, even though I'm unlikely to follow his advice. I like Ioc Containers. True, it's possible to overdo them. It's possible to end up with symptoms that Rob mentioned, like: Continue reading...

  • The next few years in browsers

    I somethimes wish that CSS was designed to work as a layout system, and not just a Cascading Style Sheet. Yes, you can do layout in css .... kind of. It works, sometimes, if you know the right special case to apply and wrap it in enough container divs. But there is hope. Css is going to get better in this respect with the CSS3 suite of proposals. By the way, there is no single CSS 3 specification, it's a raft of modules, all progressing individually. Continue reading...

  • 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...