当前位置:网站首页>炮打司令部,别让一个UI框架把你毁了
炮打司令部,别让一个UI框架把你毁了
2022-06-25 15:41:00 【InfoQ】
毁了你的视野
毁了你的技术
毁了你的状态管理
毁了你的工程
将UI框架拉下神坛
应用的核心是业务逻辑
不要过度依赖UI层
- UI说:应用要改版,皮肤、交互、页面组织都要调整,要多久?
- 产品说:把H5改改,做成小程序、APP吧,要多久?
- 经理说:React人太难招了,要不我们换成Vue吧,要多久?
- Leader说:Vue3出来了,我们升级为最新版吧,要多久?
同质化的UI框架
重提软件架构
重振Flux框架
ReduxVuexPiniaElux从State到Model
ComponentStateModel- ComponentState 是UI逻辑,应当封装在Component里面,外界也无需知道。
- Model 是业务逻辑,反映整个APP的状况,与Component无关,应当由Flux框架来统一管理。
从Event到Action
- 处理 Event 的 Handler 是UI逻辑,应当写在UI组件中
- 处理 Action 的 Handler 是业务逻辑,应当写在Controller里面
- 验证输入是否有效
- 验证当前用户是否已经登录
- 请求后端API,并等待返回
- 如果成功,保存用户信息,并跳回原页面
- 如果失败,提示错误,并留在原地
ControllerController
改良Flux框架
- 全局中心化管理导致逻辑过于集中;
- 单实例、不销毁容易造成信息累积爆炸;
- DispatchAction机制过于简单,不适合处理前因后果的长流程业务。
- 虽然坚持全局中心化管理,但Elux提出“微模块”的概念,将应用拆分层独立自治的一个个“微模块”,每个微模块仅处理自己领域内的事情。
- 不再单实例,每次路由变化都会产生一个新的空白Store,然后重新挑选有用的状态挂载,类似一种垃圾回收机制。
- 提出了ActionBus的概念,让Action作为Model中的事件来广播。
- 让Action的处理链条具备“协程”机制,更好的协同各业务动作之间的关联。
基于模型驱动
轻UI、重ModelReact/Vue/更多其它UI框架NextJSNuxtJSUI逻辑和业务逻辑
抛砖引玉
ReduxMobxVuexPinia边栏推荐
- The textfield is encapsulated by the flutter itself, which causes the data display to be disordered when the data in the list is updated.
- Understand the execution sequence of try catch finally in one diagram
- The style of the mall can also change a lot. DIY can learn about it!
- Prototype chain analysis
- Interviewer: your resume says you are proficient in mysql, so you say cluster / Union / overlay index, table return, index push down
- Golang uses Mongo driver operation - increase (Advanced)
- Free books! AI across the Internet paints old photos. Here is a detailed tutorial!
- f_ Read function [easy to understand]
- Summary of 2022 spring moves of ordinary people (Alibaba and Tencent offer)
- Several ways of SQL optimization
猜你喜欢
Mixed density network (MDN) for multiple regression explanation and code example

mysql整体架构和语句的执行流程
Consumer and producer cases of inter thread synchronization (condition variable)

Describe your understanding of the evolution process and internal structure of the method area

Dino: Detr with improved detecting anchor boxes for end to end object detection

Alvaria宣布客户体验行业资深人士Jeff Cotten担任新首席执行官

Overall MySQL architecture and statement execution process

Bugly hot update usage
Check whether the port number is occupied

10 Super VIM plug-ins, I can't put them down
随机推荐
f_ Read function [easy to understand]
Beginner bug set
Mark the same items in the Li list in red
Deep learning pytorch cifar10 dataset training "suggestions collection"
Optimization of lazyagg query rewriting in parsing data warehouse
Function and implementation of closures
Lecun predicts AgI: big model and reinforcement learning are both ramps! My "world model" is the new way
Tensorflow loading cifar10 dataset
JS add custom attributes to elements
Time wheel and implementation analysis of time wheel in go zero
一文带你搞懂 JWT 常见概念 & 优缺点
合宙Air32F103CBT6開發板上手報告
When inputting text in the shutter textfield, if the page is refreshed, the cursor position will change.
Based on neural tag search, the multilingual abstracts of zero samples of Chinese Academy of Sciences and Microsoft Asiatic research were selected into ACL 2022
Constructor Pattern
Continuous integration of aspnetcore & cloud flow
Introduction to database transactions
Why does golang's modification of slice data affect the data of other slices?
TFIDF and BM25
Servlet details