Lately I've trying to get myself into the new age of UI development and discovered ReactiveUI. I love its declarative nature.
I wanted to make a complete switch, so I tried to understand how are things made in this new world of ReactiveUI. I choose ReactiveUI because I've seen that is maintained by a very clever guy (Paul C. Betts).
I'm very new to it and I will likely be flooding StackOverflow with questions about it because I has a huge power and I think it deserves to be learnt and mastered.
Let's get into the details:
I've always used View-First. I'm a veteran user of the Cinch Framework (http://cinch.codeplex.com/)
It uses MEF to inject the ViewModels to each View. You just have to decorate your ViewModel with [ViewModel("SampleView")] and add an Attached Property to your View (ViewModelLocator.ViewModel="SampleView"), and whenever the View is Loaded, the corresponding ViewModel is instantiated and injected as its DataContext with the life cycle you choose.
This mechanism, while it's valid, has some inconveniences. The worst of them: It uses a Locator.
As Mark Seemann suggest in his book, ServiceLocator is an anti-pattern that should be avoided.
- So my first question is: is ReactiveUI built on top of a Locator-based infrastructure?
- View-First or ViewModel-First? What's better in terms of good practices, decoupling, SOLID, and stuff like these that are concerns of a crazy, pro-Microsoft Clean Code lover like me? Which will make me sleep better and provide my application with all those *ibility goodness?