The new release of Ninject 3.0 comes with a new extension that adds support for factories to Ninject. It supports factory interfaces, Func and Lazy. In this blog post I will explain how they are used.
Why using factories?
The recommended way to use IoC containers is that the composition root of the application is the only place where the container is accessed. Unfortunately many application can’t create everything at once during the application start or at the beginning of a web/wcf request because not everything is known at this moment. Therefore these applications need a way to create new instances using the kernel at a later point. Preferably we want to do this without introducing a reference to the container. This is where factories come into play. Instead of injecting the kernel into classes that need to create new instances we inject a factory. This factory is responsible to create the new instances using the kernel. There are two ways to implement such a factory: A factory interface and as a Func or Lazy.

.NET
Factory, IoC, Ninject, Open source
Ninject 3.0 release candidate has gone live. This release introduces some new feature and some changes in its behavior. This blog post will give you detailed information what has changed. It covers mainly Ninject core. Other blog posts that describe the changes and the new extensions will follow soon.

.NET
IoC, Ninject, Open source
Over the last couple of years, I’ve done a lot of pair programming. Pair programming inside my team, at customer sites, in coding dojos and in my open source projects.
Pair programming is really a great and effective experience when performed by an pair of developers knowing how to pair program.
Unfortunately, you cannot just put two developers in front of a single computer and expect them to perform perfectly from the start. Pair programming has to be learned. Both developers need to learn the difference between being the driver (the one holding the keyboard) and the navigator. See here for details.
During my pair programming sessions I encountered some recurrent stereotypes, which I list in this post.

Agile, Methodology
Pair Programming
Pair programming – two developers working together at a single computer – can result in better software written faster, but only if you know what you do.
Pair programming is not just sitting together and code as you would when being alone. Unfortunately, this is what most developers practice – resulting in a painful and ineffective experience.
To get most out of pair programming, you first have to know your setup.

Agile, Methodology, Test Driven Development
Pair Programming, TDD
Do you program or do you already TDD? 
If you prefer to do TDD you will love the eclipse plug-in called MoreUnit. It is as simple as powerful. All it does is executing tests from corresponding productive class and makes it very simple to change between them.
Just press Ctrl-J (like Jump) to jump from test to implementing class and the other way. Or press Ctrl-R (like Run) to run the test regardless if you are in the test or the implementation class. 
Agile, Java, Test Driven Development
Agile, eclipse, Java, Mockito, TDD, Test Driven Development, Testing, Unit Test, unit testing
Implementing the dispose pattern according to IDisposable can be very tedious. Why not simply use the new Lazy<T> to get rid of some boiler plate code? The trick is to define a Lazy<Action> with a function delegate which calls a release method. As long as you don’t access the value property of the lazy type the release method is not called. Lazy<T> offers the possibility to check whether the underlying value has been created or not (property IsValueCreated). Therefore we can use this to check whether we already disposed the underlying resources. Let’s see how this looks like in code:
public class SomeDisposable : IDisposable {
private Lazy<Action> dispose;
public SomeDisposable() {
this.dispose = new Lazy<Action>(() => this.Release);
}
public void Dispose() {
this.Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
if (disposing && !this.dispose.IsValueCreated) {
this.dispose.Value();
}
}
private void Release() {
this.resource1.Dispose();
this.resource2.Disconnect();
this.resource2.Dispose();
}
}
Remarks: I left out the finalizer to not clutter up the code sample too much.
Happy lazy coding!
.NET
Dispose, Lazy
The reporting mechanism allows creating a full report of the bootstrapping process. To be able to report the bootstrapping process the process must actually run and a reporter must be present. By default the bootstrapper uses a null reporter which does nothing with the report. But it is also possible to hook in a report generator which creates Visio, Enterprise Architect or … (you name it!) diagrams.
A custom reporter must implement the reporter interface IReporter. The reporter receives an IReportingContext which contains all necessary information about the bootstrapping process. The custom reporter must be passed upon the construction of the DefaultBootstrapper<TExtension>. 
.NET
bbv.Common, bbvcommon, bootstrapper
Configuration sections
The bootstrapper supports loading of configuration sections through behaviors. The behaviors responsible for loading configuration sections must be applied in the begin section of the run syntax.
ConfigurationSection
To be able to load configuration sections the ConfigurationSectionBehavior must be added in the strategy. 
.NET
bbv.Common, bbvcommon, bootstrapper
Here I will show how to get bytes from a ByteBuffer. This isn’t as simple as it sounds. 
Java
ByteBuffer, Java
Strategy
The strategy defines the order of execution for extension points and behaviors. The custom strategy must inherit from IStrategy. For convenience, use the provided abstract base class AbstractStrategy{TExtension} which simplifies defining a custom strategy. The strategy could look like the following: 
.NET
bbv.Common, bbvcommon, bootstrapper