Monday, February 8, 2010

Convention over Configuration – the Microsoft way!

I like the concept of Convention over Configuration. It really makes sense. I only need to change parts of the configuration that are specific for my case. Here’s the Wikipedia definition of the concept:

“Convention over Configuration (also known as Coding by convention) is a software design paradigm which seeks to decrease the number of decisions that developers need to make, gaining simplicity, but not necessarily losing flexibility.”

It looks like that at Microsoft, they also liked the Convention over Configuration concept. Take for example the resource files in Visual Studio. Every form has it’s its’s resource file named in format [FormName].resx. This is great, but how do I change the .resx file for a form? I only want to change .resx file name, not the form name. I’m missing the Rename command on the context menu:

.resx file rename

No rename here. OK, let’s try by clicking Properties on the Form1.resx file, and changing the name there.

.resx file rename

The filename field is read-only. So there is no way to change the file whatsoever. It seems that Microsoft didn’t quite get the bolded and colored part of the Convention over Configuration definition:

“Convention over Configuration (also known as Coding by convention) is a software design paradigm which seeks to decrease the number of decisions that developers need to make, gaining simplicity, but not necessarily losing flexibility.”

I don’t have flexibility to change the name of the .resx file for a form.

Why am I telling all of this?

If you have ever written something like this:

public class MyForm<T>: Form 
{
     ...
}

and tried to use resources on your Form, you’ll get whole kind of interesting problems. But there is not much you can do about it. Thanks for reading!

No comments:

Post a Comment