Closed sa-he closed 2 years ago
I would not rename this converter as I‘ve seen this name in many projects I was consulting for. We could create another class with the name you proposed which inherits from NullToBooleanConverter. (Not really a nice solution, I know).
On the other hand, you have to define x:Keys for each converter anyways. So, what if you just use x:Key=„ObjectIsNullConverter“ in app.xaml?
Or do you want to split the converter into two? Could give a slight improvement in performance. We could sill leave the old converter and mark it as obsolete.
Other projects use these names? To me, this is even more reason to rename. It is only going to be a conflict if other projects use the same namespace (which is unlikely). In my opinion good names tell a consuming developer what the converter is doing. For these two I had to look at the source code in order to understand them.
No, I do not suggest to split a converter.
I just went through the list again and add to the list of rename suggestions these:
DateTimeConverter -> DateTimeToStringConverter
VisibilityInverter -> InvertVisibilityConverter // This one is just to meet the unspoken convention that normally they end with "Converter"
True that. Check github for occurances of converter names:
I think it is a matter of taste too.
Yes it is. Feel free to decide however you prefere.
I know what you must be thinking now: "Why should I name my stuff as wrong as 480 others did" 😄 But the other 480 will be frustrated if their nulltoboolconverter isn't there anymore. I'll ask some more people of what they think.
The problem with renaming things is that you introduce breaking changes. I'm a fan of refactoring, but I'm not sure if this is a good idea on such a project.
True. I will not rename converters as there are many different opinions on names. I prefere the way of inheriting existing converters innorder to create alias class names. Hope that‘s fine.
NullToBoolConverter -> ObjectIsNullConverter IsEmptyConverter -> EnumerableIsEmptyConverter