gpt4 book ai didi

angularjs - MVW 代表什么?

转载 作者:行者123 更新时间:2023-12-03 03:58:08 25 4
gpt4 key购买 nike

这是 AngularJS 页面的内容描述:

AngularJS is what HTML would have been, had it been designed for building web-apps. Declarative templates with data-binding, MVW, MVVM, MVC, dependency injection and great testability story all implemented with pure client-side JavaScript!

那么 MVW 代表什么?(考虑到 MVC、MVVW、MVP 等争论,我猜“随便”,模型- View -随便 =P)

最佳答案

它确实代表任何东西,如whatever works for you根据 2012 年 Igor Minar 的说法(强调我的):

MVC vs MVVM vs MVP. What a controversial topic that many developerscan spend hours and hours debating and arguing about.

For several years +AngularJS was closer to MVC (or rather one of itsclient-side variants), but over time and thanks to many refactoringsand api improvements, it's now closer to MVVM – the $scope objectcould be considered the ViewModel that is being decorated by afunction that we call a Controller.

Being able to categorize a framework and put it into one of the MV*buckets has some advantages. It can help developers get morecomfortable with its apis by making it easier to create a mental modelthat represents the application that is being built with theframework. It can also help to establish terminology that is used bydevelopers.

Having said, I'd rather see developers build kick-ass apps that arewell-designed and follow separation of concerns, than see them wastetime arguing about MV* nonsense. And for this reason, I hereby declareAngularJS to be MVW framework - Model-View-Whatever. Where Whateverstands for "whatever works for you".

Angular gives you a lot of flexibility to nicely separate presentationlogic from business logic and presentation state. Please use it fuelyour productivity and application maintainability rather than heateddiscussions about things that at the end of the day don't matter thatmuch.

关于angularjs - MVW 代表什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13329485/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com