Oct
4
Written by:
Oleg Zhukov
10/4/2008 1:52 AM
Some time ago I've run into the concept of idiomatic design patterns. I soon liked this term and added it to my developer's vocabulary. Well, what is the idiomatic design pattern?
An idiomatic design principle is a common design rule which applies to a specific technology or field. Good examples of idiomatic patterns are C# design guidelines given in Jeffey Richter's famous "CLR via C#" book. For instance, he recommends using the following construct:
Company comp = contact as Company;
if (comp != null)
{
// Do something
}
instead of:
if (contact is Company)
{
Company comp = contact as Company;
// Do something
}
since the latter code fragment contains more type conversions (two against one in the former fragment).
Sometimes idiomatic principles emerge as a consequence of fundamental design patterns. This is the case with a recommendation to less use the .NET List<T> generic type. For details see Dino Esposito's recent article.
Another examples of idiomatic patterns are the coding standarts adopted by a particular development team. They are the idiomatic rules intended for a specific software project, pure and simple.
Tags: