I'm learning F#, I want to build the next module of my home project. So far most of my F# code has been test code written with the command line. I also did some custom drawing to a Winforms Panel. So far, I haven't had to use one mutable variable. but now I'm trying to write some actual code and as soon as I got to the ViewModel part it seemed that I had no choice but to make the variables that will interact with the UI mutable. Is this true, or is there something I'm missing?
For MVVM, F# carries one very significant advantage: it does not allow circular dependencies. This makes it very difficult to break the pattern: i.e. to allow the model to directly affect the viewmodel, or the viewmodel to access the view. As Bent says, F# is multi-paradigm: it supports properties with getters and setters, and these are not things to be eschewed in the language.
It's interesting that I'm citing a lack of capability as one of the advantages of F#, but I feel it is precisely this preclusion of circular dependencies that makes the language a good choice for an enterprise architecture.
I have a toy project at https://github.com/SpiegelSoft/Astrid. You can look through that to see how I've implemented MVVM using ReactiveUI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With