What is the main goal of MVVM pattern? [closed]

Could you tell me what is the goal of the MVVM pattern? What are the arguments or the reasons I can give to a team and product owner to respect and develop according to this pattern?

I would like a simple answer. Something in one sentence or one word. Is it for

  • maintenance
  • security
  • testing
  • something else?

3

My simplistic answer is that in the standard MVC concept, the Model knows nothing about the View. However, on GUI platforms that support data binding, the View needs bind to something that is responsive to changes in what the user sees, and the Model cannot satisfactorily fill that role. Data Binding is a Good Thing, but not easily reconciled with MVC.

The ViewModel is specifically a set of data structures provided for data binding, so that it can contain all the data items required by the View and be updated as necessary, without polluting the Model. In doing so it acts as a layer between the View and Model, where both the Model and ViewModel are updated by the Controller, often via event driven code.

I’m not convinced that Microsoft invented it, but I do think it originated in the Microsoft community, since data binding is a prominent part of Microsoft architectures (particularly those based on XAML).

Wikipedia is pretty good: http://en.wikipedia.org/wiki/Model_View_ViewModel

MVVM is basically just a modern refinement of the MVC pattern, so the main goal is still the same as that of MVC: to provide a clear separation between domain logic and presentation logic. This can be boiled down to code quality: by adhering to the concepts of high cohesion and loose coupling, you stand a much better chance of sustaining productivity over time. Clear separations of concerns simplifies the use and maintenance of your code, and loose coupling between components makes testing and code reuse easier.

That would be my general argument for using MVVM over not using any such pattern. Whether it’s a good idea to use MVVM in particular over e.g. MVC or MVP is indeed subjective and depends on the application.

1

The basic reasons of using MVVM are Separation of Concerns (SOC) and Single Responsibility Principle (SRP). Then you have Flexibility, Maintenance and Testing.

The goal of MVVM was to apply the above on WPF. WPF provides “plumbing” to allow easy use of MVVM through Data Binding.

For SOC and SRP read: Separation of Concerns(Wikipedia) and Single Responsibility Principle(Wikipedia). But the basis is: The logic doesn’t care that the button is red and situated on the left top corner. Only the UI cares about it.

Flexibility on this case is the ability that one ViewModel can provide to different Views, or one View can use several ViewModels, that one ViewModel can use more that one Model, and that a Model can be used on separate ViewModels.

Maintenance is a consequence of SOC and SRP. It is much easier to change parts of the code or UI without affecting other sections.

For Testing, now you can do automated testing of your logic without having a window pop up. You can isolate the tests and mock whatever is needed (if at all).

To the product owner what you have to say is that it will become easier to make changes and to affirm(test) that the application is behaving as expected.

To the developers: it will make your life easier.

If you are not using WPF, maybe look into MVC(Wikipedia) or MVP(Wikipedia)

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

What is the main goal of MVVM pattern? [closed]

Could you tell me what is the goal of the MVVM pattern? What are the arguments or the reasons I can give to a team and product owner to respect and develop according to this pattern?

I would like a simple answer. Something in one sentence or one word. Is it for

  • maintenance
  • security
  • testing
  • something else?

3

My simplistic answer is that in the standard MVC concept, the Model knows nothing about the View. However, on GUI platforms that support data binding, the View needs bind to something that is responsive to changes in what the user sees, and the Model cannot satisfactorily fill that role. Data Binding is a Good Thing, but not easily reconciled with MVC.

The ViewModel is specifically a set of data structures provided for data binding, so that it can contain all the data items required by the View and be updated as necessary, without polluting the Model. In doing so it acts as a layer between the View and Model, where both the Model and ViewModel are updated by the Controller, often via event driven code.

I’m not convinced that Microsoft invented it, but I do think it originated in the Microsoft community, since data binding is a prominent part of Microsoft architectures (particularly those based on XAML).

Wikipedia is pretty good: http://en.wikipedia.org/wiki/Model_View_ViewModel

MVVM is basically just a modern refinement of the MVC pattern, so the main goal is still the same as that of MVC: to provide a clear separation between domain logic and presentation logic. This can be boiled down to code quality: by adhering to the concepts of high cohesion and loose coupling, you stand a much better chance of sustaining productivity over time. Clear separations of concerns simplifies the use and maintenance of your code, and loose coupling between components makes testing and code reuse easier.

That would be my general argument for using MVVM over not using any such pattern. Whether it’s a good idea to use MVVM in particular over e.g. MVC or MVP is indeed subjective and depends on the application.

1

The basic reasons of using MVVM are Separation of Concerns (SOC) and Single Responsibility Principle (SRP). Then you have Flexibility, Maintenance and Testing.

The goal of MVVM was to apply the above on WPF. WPF provides “plumbing” to allow easy use of MVVM through Data Binding.

For SOC and SRP read: Separation of Concerns(Wikipedia) and Single Responsibility Principle(Wikipedia). But the basis is: The logic doesn’t care that the button is red and situated on the left top corner. Only the UI cares about it.

Flexibility on this case is the ability that one ViewModel can provide to different Views, or one View can use several ViewModels, that one ViewModel can use more that one Model, and that a Model can be used on separate ViewModels.

Maintenance is a consequence of SOC and SRP. It is much easier to change parts of the code or UI without affecting other sections.

For Testing, now you can do automated testing of your logic without having a window pop up. You can isolate the tests and mock whatever is needed (if at all).

To the product owner what you have to say is that it will become easier to make changes and to affirm(test) that the application is behaving as expected.

To the developers: it will make your life easier.

If you are not using WPF, maybe look into MVC(Wikipedia) or MVP(Wikipedia)

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật