René's URL Explorer Experiment


Title: 前端 MVC/MVP/MVVM 模式 · Issue #12 · webproblem/Blog · GitHub

Open Graph Title: 前端 MVC/MVP/MVVM 模式 · Issue #12 · webproblem/Blog

X Title: 前端 MVC/MVP/MVVM 模式 · Issue #12 · webproblem/Blog

Description: 前言 之前有碰到过一些关于对 MVC/MVP/MVVM 模式理解的面试题,以及它们之间的异同,这里就做下简单的笔记。 由于软件架构设计模式的知识点理解起来会比较吃力,网上也很少有较权威的讲解文章,所以这里的笔记可能会存在知识点比较浅显或者错误的理解,待以后有深刻的理解后再修正,这里只记录当前对 MV* 模式的理解。 需要注意的是,这种 MV* 模式和设计模式是有区别的。MV* 模式是一种管理与组织代码的学问,其本质是一种软件开发的模型。而设计模式是在解决一类问题的基础上...

Open Graph Description: 前言 之前有碰到过一些关于对 MVC/MVP/MVVM 模式理解的面试题,以及它们之间的异同,这里就做下简单的笔记。 由于软件架构设计模式的知识点理解起来会比较吃力,网上也很少有较权威的讲解文章,所以这里的笔记可能会存在知识点比较浅显或者错误的理解,待以后有深刻的理解后再修正,这里只记录当前对 MV* 模式的理解。 需要注意的是,这种 MV* 模式和设计模式是有区别的。MV* 模式是一种管理...

X Description: 前言 之前有碰到过一些关于对 MVC/MVP/MVVM 模式理解的面试题,以及它们之间的异同,这里就做下简单的笔记。 由于软件架构设计模式的知识点理解起来会比较吃力,网上也很少有较权威的讲解文章,所以这里的笔记可能会存在知识点比较浅显或者错误的理解,待以后有深刻的理解后再修正,这里只记录当前对 MV* 模式的理解。 需要注意的是,这种 MV* 模式和设计模式是有区别的。MV* 模式是一种管理...

Opengraph URL: https://github.com/webproblem/Blog/issues/12

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"前端 MVC/MVP/MVVM 模式","articleBody":"### 前言\r\n\r\n之前有碰到过一些关于对 MVC/MVP/MVVM 模式理解的面试题,以及它们之间的异同,这里就做下简单的笔记。\r\n\r\n由于软件架构设计模式的知识点理解起来会比较吃力,网上也很少有较权威的讲解文章,所以这里的笔记可能会存在知识点比较浅显或者错误的理解,待以后有深刻的理解后再修正,这里只记录当前对 MV* 模式的理解。\r\n\r\n需要注意的是,这种 MV* 模式和设计模式是有区别的。MV* 模式是一种管理与组织代码的学问,其本质是一种软件开发的模型。而设计模式是在解决一类问题的基础上总结出来的解决方案,是具体写代码的方式。\r\n\r\n且前后端的 MV* 模式是不相同的,不能混为一谈。以 MVC 模式为例区分前后端之间的区别如下:\r\n\r\n![前后端MVC](https://user-images.githubusercontent.com/20440496/48963506-df181900-efce-11e8-9af8-b3a0be827967.png)\r\n\r\n\r\n### MVC/MVP/MVVM 是什么?之间的异同又是什么?\r\n\r\n#### MVC\r\n\r\n![image](https://user-images.githubusercontent.com/20440496/48963510-eb03db00-efce-11e8-9afc-70a0fdad0ea3.png)\r\n\r\n\r\nMVC 分为 3 个模块,Model(数据层),View(视图层),Controller(控制器)。模块之间的依赖关系如下:\r\n\r\n* Model: 对外暴露函数调用接口和事件接口,不依赖 Controller和 View。\r\n* View: 对外暴露用户触发事件接口,并监听 Model 数据变化触发的事件,依赖于 Model。\r\n* Controller: 监听 View 的用户事件,并对 Model 的接口了如指掌,依赖于 Model和 View。\r\n\r\n数据流回路流程如下:\r\n\r\n* 用户与 View 交互,触发用户事件\r\n* Controller 监听到用户事件,调用 Model 接口,改变 Model 层的数据\r\n* Model 层数据变化触发相应的事件,将新的数据传递给 View 层,View 做出改变,用户得到反馈\r\n\r\n#### MVP\r\n\r\n![MVP](https://user-images.githubusercontent.com/20440496/48963513-f525d980-efce-11e8-99bf-1804847b8cf9.png)\r\n\r\nMVP 分为 3 个模块,Model,View,Presenter。模块之间的依赖关系如下:\r\n\r\n* Model: 对外暴露函数调用接口和事件接口,不依赖 Presenter 和 View。\r\n* View:  对外暴露函数调用接口和用户触发事件接口,不依赖 Presenter 和 View。\r\n* Presenter: 监听 View 和 Model 的事件,并对它们的接口了如指掌,所以依赖于 Model 和 View。 \r\n\r\n数据流回路流程如下:\r\n\r\n* 用户与 View 交互,触发用户事件\r\n* Presenter 监听到用户事件,调用 Model 接口,改变 Model 层的数据\r\n* Model 层数据变化触发相应的事件,事件被 Presenter 层监听到,调用 View 暴露函数调用接口,View 做出改变,用户得到反馈\r\n\r\n#### MVVM\r\n\r\n![MVVM](https://user-images.githubusercontent.com/20440496/48963517-0a026d00-efcf-11e8-8a61-5be462d86532.png)\r\n\r\n\r\nMVVM 分为 3 个模块,Model,View,ViewModel 。模块之间的依赖关系如下:\r\n\r\n* Model: 对外暴露函数调用接口和事件接口,不依赖 ViewModel 和 View。\r\n* View: 监听用户交互事件,然后调用 ViewModel 的响应逻辑,同时将自己的显示状态与 ViewModel 的状态数据绑定在一起,所以依赖于 ViewModel。 \r\n* ViewModel: 监听 Model 的事件,并对 Model 的接口了如指掌,依赖于 Model。同时向 View 暴露响应逻辑的调用接口,以及所有的状态数据,并不依赖于 View。 \r\n\r\n数据流回路流程如下:\r\n\r\n* 用户与 View 交互,触发用户事件\r\n* View 层调用起 ViewModel 层的响应逻辑的接口\r\n* ViewModel 层的响应逻辑处理完后,调用 Model 接口,改变 Model 层的数据\r\n* Model 层数据变化触发相应的事件,被 ViewModel 监听到,并更新 ViewModel 的数据状态\r\n* ViewModel 层的数据状态的改变会引起 View 的状态改变,View 做出改变,用户得到反馈\r\n\r\n#### 总结\r\n\r\n* MVC: Controller 作为 View 层和 Model 层之间的连接点,连接 View -\u003e Model 之间的通信,Model 层的数据更新后会通知 View 层的视图更新并反馈给用户。View 和 Model 之间的强耦合度会加大调试时的难度。\r\n* MVP: Presenter 承接起了 View 和 Model 之间的双向通信,View 与 Model 不发生联系,降低了耦合度且方便单元测试。\r\n* MVVM: ViewModel 中构建了一组状态数据,作为 View 状态的抽象,通过双向数据绑定使 ViewModel 中的状态数据与 View 的显示状态保持一致,这样 View 的显示状态变化会自动更新 ViewModel 的状态数据,ViewModel 状态数据的变化也会自动同步 View 的显示状态。\r\n\r\n### 参考\r\n\r\n* [浅析前端开发中的 MVC/MVP/MVVM 模式](https://juejin.im/post/593021272f301e0058273468)\r\n\r\n* [浅析 MVC, MVP 与 MVVM之间的异同](http://wzhscript.com/2015/02/03/mvc-mvp-and-mvvm/)\r\n\r\n* [浅谈 MVC、MVP 和 MVVM 架构模式](https://draveness.me/mvx)\r\n  \r\n\r\n","author":{"url":"https://github.com/webproblem","@type":"Person","name":"webproblem"},"datePublished":"2018-11-24T01:46:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/12/Blog/issues/12"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:91cefeb8-412d-04b3-b7f8-da20662495af
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id947A:5BCF5:33C2136:4225937:6975D6FB
html-safe-nonceda1b682cc39f3f4257d050bce0b7bb3f257ece1111863174afc0493c6285fb1c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDdBOjVCQ0Y1OjMzQzIxMzY6NDIyNTkzNzo2OTc1RDZGQiIsInZpc2l0b3JfaWQiOiI3NjYxNjEwNTMxMjMxNzQ5ODgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7f8ab9fbb9be0d3ff00e730fa4f98ba4f8fee1e689f7849c9e9037a74b351d3c
hovercard-subject-tagissue:383950036
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/webproblem/Blog/12/issue_layout
twitter:imagehttps://opengraph.githubassets.com/7dfd9beb98690925c1313c3e0fb86e680ab58f4147cf85503995811a68238783/webproblem/Blog/issues/12
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7dfd9beb98690925c1313c3e0fb86e680ab58f4147cf85503995811a68238783/webproblem/Blog/issues/12
og:image:alt前言 之前有碰到过一些关于对 MVC/MVP/MVVM 模式理解的面试题,以及它们之间的异同,这里就做下简单的笔记。 由于软件架构设计模式的知识点理解起来会比较吃力,网上也很少有较权威的讲解文章,所以这里的笔记可能会存在知识点比较浅显或者错误的理解,待以后有深刻的理解后再修正,这里只记录当前对 MV* 模式的理解。 需要注意的是,这种 MV* 模式和设计模式是有区别的。MV* 模式是一种管理...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamewebproblem
hostnamegithub.com
expected-hostnamegithub.com
None2bce766e7450b03e00b2fc5badd417927ce33a860e78cda3e4ecb9bbd1374cc6
turbo-cache-controlno-preview
go-importgithub.com/webproblem/Blog git https://github.com/webproblem/Blog.git
octolytics-dimension-user_id20440496
octolytics-dimension-user_loginwebproblem
octolytics-dimension-repository_id115346710
octolytics-dimension-repository_nwowebproblem/Blog
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id115346710
octolytics-dimension-repository_network_root_nwowebproblem/Blog
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasefcca2b8ef702b5f7f91427a6e920fa44446fe312
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/webproblem/Blog/issues/12#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fwebproblem%2FBlog%2Fissues%2F12
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fwebproblem%2FBlog%2Fissues%2F12
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=webproblem%2FBlog
Reloadhttps://patch-diff.githubusercontent.com/webproblem/Blog/issues/12
Reloadhttps://patch-diff.githubusercontent.com/webproblem/Blog/issues/12
Reloadhttps://patch-diff.githubusercontent.com/webproblem/Blog/issues/12
webproblem https://patch-diff.githubusercontent.com/webproblem
Bloghttps://patch-diff.githubusercontent.com/webproblem/Blog
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fwebproblem%2FBlog
Fork 15 https://patch-diff.githubusercontent.com/login?return_to=%2Fwebproblem%2FBlog
Star 113 https://patch-diff.githubusercontent.com/login?return_to=%2Fwebproblem%2FBlog
Code https://patch-diff.githubusercontent.com/webproblem/Blog
Issues 10 https://patch-diff.githubusercontent.com/webproblem/Blog/issues
Pull requests 0 https://patch-diff.githubusercontent.com/webproblem/Blog/pulls
Actions https://patch-diff.githubusercontent.com/webproblem/Blog/actions
Projects 0 https://patch-diff.githubusercontent.com/webproblem/Blog/projects
Security 0 https://patch-diff.githubusercontent.com/webproblem/Blog/security
Insights https://patch-diff.githubusercontent.com/webproblem/Blog/pulse
Code https://patch-diff.githubusercontent.com/webproblem/Blog
Issues https://patch-diff.githubusercontent.com/webproblem/Blog/issues
Pull requests https://patch-diff.githubusercontent.com/webproblem/Blog/pulls
Actions https://patch-diff.githubusercontent.com/webproblem/Blog/actions
Projects https://patch-diff.githubusercontent.com/webproblem/Blog/projects
Security https://patch-diff.githubusercontent.com/webproblem/Blog/security
Insights https://patch-diff.githubusercontent.com/webproblem/Blog/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/webproblem/Blog/issues/12
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/webproblem/Blog/issues/12
前端 MVC/MVP/MVVM 模式https://patch-diff.githubusercontent.com/webproblem/Blog/issues/12#top
https://github.com/webproblem
https://github.com/webproblem
webproblemhttps://github.com/webproblem
on Nov 24, 2018https://github.com/webproblem/Blog/issues/12#issue-383950036
https://user-images.githubusercontent.com/20440496/48963506-df181900-efce-11e8-9af8-b3a0be827967.png
https://user-images.githubusercontent.com/20440496/48963510-eb03db00-efce-11e8-9afc-70a0fdad0ea3.png
https://user-images.githubusercontent.com/20440496/48963513-f525d980-efce-11e8-99bf-1804847b8cf9.png
https://user-images.githubusercontent.com/20440496/48963517-0a026d00-efcf-11e8-8a61-5be462d86532.png
浅析前端开发中的 MVC/MVP/MVVM 模式https://juejin.im/post/593021272f301e0058273468
浅析 MVC, MVP 与 MVVM之间的异同http://wzhscript.com/2015/02/03/mvc-mvp-and-mvvm/
浅谈 MVC、MVP 和 MVVM 架构模式https://draveness.me/mvx
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.