Anthony Steele's Blog
-
The DSLs in C sharp
A while back I wrote a blog post about as LINQ considered as a Domain-specific language. C# has DSLs, more of them over time, but as users of c# we don't have acess to this layer of the compiler.
-
Ranting about HTML apps and rich applications
Web apps and RIAA apps – which better and why? In which I rant about web development.
There's a lot of noise about Silverlight, WPF, Html 5 and which is "winning" lately. Some good ones are here , here and here. See also the comments here.
-
Hex
Hex is an old project of mine, code that I have picked up and tinkered with from time to time. It's an implementation of the game of Hex in C#.
What does one do with old code and learning projects? Sometime they just get left on the hard drive, and sometimes they get used for more learning, and sometimes you want to back them up by open-sourcing them and uploading to a public repository.
-
Ddd8a
I went to the "modern .Net" Developer Day, AKA DDD8a on Saturday, and it was an excellent day. Continue reading...
-
Blog outage last weekend
This blog stopped working, some time around Friday 1 October 2010. I know that it worked on Thursday night, and that it was broken on Saturday. Orchard had gone wrong, and it was showing a yellow error page including a compilation error: The type or namespace name 'Comments' does not exist in the namespace 'Orchard' Continue reading...
-
New Kindle 3
My latest gadget is an Amazon Kindle v3. I am enjoying it a lot.
Why an e-book reader? It's partly just shiny-gadget-want and curiosity, but also it's that I read a lot and it wasn't too expensive. I travel a few times a year, and it will help to have an e-book reader replacing a big pile of books. If it's much lighter it doesn't need to be a better reading experience, just nearly as good.
-
Thoughts on making coding standards
We've all done it. You're tired of the one colleague who always codes with a layout that you can't stand, so a coding standard is brought up. Before you do so, consider this advice:
-
Upgrade complete to Orchard August 2010
I have upgraded my blog's platform to the August 2010 release of Orchard. I still have a little interest in Orchard, but any free time to actually hack on it is proving non-existent. Continue reading...
-
The LightCore IoC container 1.4
I have looked at the LightCore IoC container before in this blog post reviewing it. Now Peter Bucher has released version 1.4.1 of LightCore.
I'm happy to say that this fixes the issue that I had with version 1.0 and things work smoothly.
-
The single exit point law
It is sometimes said that a method should have only one return statement (i.e. one exit point) and that to code using more than one return per method is bad practice. It is claimed to be a risk to readability or a source of error. Sometimes this is even given the title of the "single exit point law". Actually, if you want to call something a law, I'd expect some evidence for it. I do not know of any formal study that back this "law" up, or of any study of the multiple-return pattern at all. This makes it a "preference" not a "law". And it's a preference that I do not hold for c# code. Or java, ruby or python code either. Continue reading...
-
Indentation of trailing lines of code
I'd like to blog about a point of code indentation. I have a strong and unusual opinion on this topic, that the way that most people do it is ... less than best.
I suspect that about half of the readers will not want to read further, since they already know the right way to indent code (the way that they do it already, whatever that may be) and the other half won't want to read further, for fear of getting involved in the religious wars, lest the nits that I pick infest them too. But anyway, though de gustibus non est disputandum (that's Latin for there's no accounting for taste), consider the following as an option.
-
Comparing .Net IoC containers source is now on github
The source for the comparisons that I have done on IoC Containers is now on Github at http://github.com/AnthonySteele/IoCComparison Continue reading...
-
The LightCore IoC container
I have had a look at LightCore, which is written by Peter Bucher, who works in Germany and Switzerland. It is available with source, and has a public SVN repository. The documentation is in German, but it isn't hard to work out what the code samples do. Continue reading...
-
The Funq IoC Container
I was asked to look at Funq, an IoC container that aims to be lightweight and high performance, using lambdas and generics to eliminate the use of runtime reflection. It was made by Daniel Cazzulino (@kzu), and in a series of screen casts he shown the whole process of developing Funq using TDD. This is very impressive and may be a good introduction to TDD, but aside from this, there is little or no documentation. Videos are all very well, but they are no substitute for written code examples. So I may have missed how to do things in Funq. Continue reading...
-
Comparing .Net IoC containers, part seven: MEF
The Managed Extensibility Framework from Microsof is part of the .Net 4.0 framework, but is not an IoC container. Well, not quite, but so close that you might take it for one. It is an Extensibility framework. It really shines when you want to know about all the classes that implement some interface (say IPlugin or IApplicationPart), and get notified when a new one shows up at runtime. So you can get told about all the plugins or components that your application has been given. Continue reading...
-
Comparing .Net IoC containers, part six: Spring.Net
Spring.NET is a port of a popular Java framework called Spring. Spring is very popular in the Java world, and it covers a lot of things, including IoC. Since I am comparing IoC containers in this article, I will address only the IoC aspects of the spring.Net port. Continue reading...
-
Comparing .Net IoC containers, part five: Autofac
I had not used Autofac before this test series, but it used on the Orchard blog engine project and has some interesting advanced features and was quite usable for the basic operations in the tests. The Autofac source code is under the MIT licence is on google code, and is written by Nicholas Blumhardt and other contributors. I have updated this blog post in June 2011 with new code for StructureMap 2, based on the comments by Brendan Forster.
Autofac requires all types to be registered, and creates a new instance each time by default.
With Autofac's syntax we are back in the more familiar terain of RegisterType<T>.As<U>(); and Resolve<T>. Note that the RegisterType<T> happens on a ContainerBuilder, and then a container is built from it which can Resolve. Like StructureMap, this emphasises that registration happens before use. The container is not actually immutable (in version 2 onwards), though it doesn't look like changing a container a lot after setup it is encouraged.
-
Comparing .Net IoC containers, part four: StructureMap
this test was my first use of StructureMap but I know that it was written by Jeremy D. Miller with help from other contributors. The Apache-licenced source is on Github. It's a fairly modern-looking design, using lambdas. In fact, I could criticise it for requiring lambdas and thus more typing where other IoC containers do not require them. But the point of the single method that does all registration is that it is atomic - it prevents the container being used when registration is half-completed. Continue reading...
-
Comparing .Net IoC containers, part three: Ninject
I have used NInject before and found it easy to work with. We used it because at the time it was the only IoC container that worked with Silverlight. The syntax is quite different to the others - you define the configuration in one or more Modules which inherit from NinjectModule, and are then loaded into the kernel. Continue reading...
-
Comparing .Net IoC containers, part two: Castle Windsor
Castle Windsor is perhaps the most well-known .Net IoC container. It is well-established and flexible. Continue reading...