F # WPF MVVM can I do this without changing view model variables?

I am 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 on the command line. I also made some custom drawing in the Winforms panel. So far, I have not 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 like I had no choice but to make variables that would interact with the mutable user interface. Is this true, or is something missing?

+6
source share
2 answers

For MVVM, F # has one very important advantage: it does not allow circular dependencies. This makes it very difficult to break the template: to allow the model to directly influence the viewmodel or viewmodel to access the view. According to Bent, F # is a multi-paradigm: it supports properties with getters and setters, and this is not something that should be avoided in the language.

Interestingly, I cite the lack of features as one of the advantages of F #, but I feel that it is this exclusion of circular dependencies that makes the language a good choice for corporate architecture.

I have a toy project at https://github.com/SpiegelSoft/Astrid . You can view this to see how I implemented MVVM using ReactiveUI.

+5
source

, . MVVM .

, MVC, . GitHub:

http://fsprojects.imtqy.com/FSharp.Desktop.UI/

, , , .

,

, Haskell, , Ocaml . , F #. Haskell , , .NET, F # - , .NET.

mutable F # . , , . , , #.

+2

Source: https://habr.com/ru/post/1014721/


All Articles