Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

With advent of WPF and MVVM Microsoft introduced DependencyProperties and INotif

ID: 643877 • Letter: W

Question

With advent of WPF and MVVM Microsoft introduced DependencyProperties and INotifyPropertyChange interface to provide a way to implement the "reactive" approach used with those technologies.

Sadly both of these constructs are very verbose, require much boilerplate, are clumsy to use, also are not really that safe since they require much use of "magic strings".

So here come the question: why didn't they put these functionalities directly into the language - why didn't they create new kind of properties created with a simple keyword, providing useful stuff of DependencyProperties (like events on change and so on...).

What were stopping them?

Explanation / Answer

Dependecy properties are very WPF-specific. As far as I know, even WinRT (which is XAML-based, just like WPF) doesn't use them. So, you are proposing adding a feature that wouldn't be at all useful for people who develop ASP.NET applications, Windows services, web services, WinRT applications, etc. That's points against this feature.

Also, it's not clear to me how exactly would this work. How would you set the default value of the property? Or PropertyChangedCallback? What about attached properties? If the feature you're proposing couldn't handle all this, it would make it much less useful. If it did, I have no idea how would the syntax look like, but I doubt it would fit well with the rest of C#.

And this feature doesn't actually add much, it just makes some code slightly more convenient.

This all says to me that such a feature wouldn't be worth it, considering that it would be relatively complicated change that would be useful only in a relatively small subset of programs and even in those wouldn't be actually useful that much.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote