Language Level Pattern Support
One thing I've been wondering lately is why there isn't more support for design patterns at the language or framework level in any language. It would really speed things up. I guess the addition of C# templates could solve some of these issues, but it sure would be nice to have some functionality built into the compiler for things such as factories.
Example:
public factory Brick : IBrick
{
public Brick CreateInstance()
{
return new ConcreteBrick();
}
}
Then, in my code I could write:
public void SomeMethod()
{
IBrick brick = new Brick();
// Do something...
}
Instead of:
public void SomeMethod()
{
BrickFactory factory = new BrickFactory();
IBrick brick = factory.CreateBrick();
// Do something...
}
Yes, it is only one line of code that is different in this case, but the former is so much cleaner. Additionally, it would be a lot easier to come back later and modify existing code to use a factory pattern, because all you would have to do is provide that factory class, rather than manually eliminate every occurance of "new ConcreteBrick()".