I've just been reading Josh Smith's MVVM article and am working on a WPF application at the moment. I'm umming and ahing about transfering my work so far to MVVM but find the idea of working purely through databinding and ICommands without any UI event handlers, a little daunting in the sense that it could take a while to convert what I've done up to now.
I'm a self taught C#-er and I've yet to apply patterns such as this to my projects which have up to now just been using the code-behind model and separating out business logic and data access into separate assemblies.
I know that my code can get a little confused sometimes with regard to what belongs where so I was looking into 开发者_运维问答patterns as a way to help me get things straight.
What other patterns might I look at? Any links to articles appreciated.
Some other presentation patterns that you may want to take a look at are Model View Presenter and Model View Controller.
Martin Fowler has a number of good articles on presentation patterns as does Jeremy Miller. Jeremy is coming out with a book on presentation patterns in the (hopefully) near future. Take a look at his wiki and Fowler's site.
- http://martinfowler.com/eaaCatalog/
- http://www.jeremydmiller.com/ppatterns/Default.aspx?Page=MainPage&AspxAutoDetectCookieSupport=1
My advice when adopting the MVVM pattern for WPF applications is to leverage off one of the existing toolkits such as MVVMLight by Laurent Bugnion. Once you get your head around messaging the loss of event driven code behind based logic seems plausible. It's still a little tedious in terms of LOB development if you're coming from an old-school forms over data background but once you are into the swing of it you will see the benefits and UI power that can be derived from bindings and value converters.
精彩评论