Factory
There are 2 entries for the tag Factory

Sometimes i think I spend my time on this blog just trying to explain the thinking of people much smarter than me.  This is definitely one of those cases.  I've probably learned more about programming from reading the Retlang source code than any other.  It's both remarkably free of compromises and easy to read.  Sometimes you learn not from any individual snapshot, but from the evolution of the code base.  For instance, here was the process context factory in Retlang 0.3: public interface IProcessContextFactory : IThreadController, IObjectPublisher { ...

Okay, we're onto the first of what I described as the "stone cold brilliant patterns".  This particular one looks obvious, but its benefits are actually quite subtle.  There are basically only two ways of creating an object in .NET: Call new Call a function that calls new The factory pattern is basically just using the latter.  Now, this might strike you as an unnecessary level of indirection, and you might be right.  You'd be right if: The class is a pure data transfer object. The class doesn't have a complex data structure. The class has...