当前位置:网站首页>初学者如何正确理解google官方建议架构原则(疑问?)
初学者如何正确理解google官方建议架构原则(疑问?)
2022-07-01 08:05:00 【灯塔@kuaidao】
前言
最近花时间看了google 的Jetpack 架构组件,kotlin协程、flow。接着了google官方推荐应用架构指南,compose等。这些目是 目前主流应用开发采用的技术栈。我们项目中已经搭建起来了,但是自己理解的很浅,使用官网推荐的架构写起来心里总觉的没有使用MVP 写起来直来直去。但是这些才是未来应该掌握的技术栈,记录下疑惑的地方。
1.标准数据驱动代码样式,和各个层的职责,各层之间如何进行关联。
UI层
Activity、Fragment中是否只放ui相关代码: ui相关代码指的是那些代码?
是否是元素的显示隐藏,添加和移除。字体色值,图片样式,字体大小,是否正在刷新这些只和View 本身属性有关系的元素。
viewModel 放入什么代码?起什么作用。
比方说,登录界面中的 [条件检查逻辑],EditerText的 textChange逻辑,检查密码是否符合这样的判断逻辑也放进去吗?viewModel 中需要给界面暴露方法,这些方法是否需要suspend 修饰。
网域层 (xxxUserCase)
网域层放入什么类型代码,是否需要suspend修饰。对外暴漏什么样式代码。 网域层可以创建object class 单例类吗
xxxxResp 存储库
存储库拆分,如何理解存储库拆分,怎么拆分才是正确或者相对正确的。
xxDataSource 数据源
数据源在应用中只有,文件,数据库,内存,网络这些。 如果前期把这些定义了, 也就是四种数据源。 是否就应该这么定义
NetDataSource ,DbDataSource ,FileDataSource DataStoreDataSource ,那么一个大型项目只定义这四种数据元,肯定是不够的,如何细分下去
这是大面上来讲。
工具库,widget 自定义布局,元素 , 通用网络请求逻辑,拆到那里?
还有协程用法,也是一知半解。 协程嵌套用法, 使用协程发起的网络请求和普通网络请求之间怎么控制时序,那个先执行后执行另一个。并行执行,嵌套写法
自己照葫芦画瓢写的协程嵌套代码,自己写起来就费劲,感觉越写越没底。主要是网络请求代码嵌套看起来并不优雅也不美观。
如何理解业务逻辑
功能逻辑:详细讲解该功能的逻辑。
交互逻辑:对页面之间的相互跳转进行说明。
视觉逻辑:对颜色,对图标的要求。
业务逻辑:讲一下该功能对应着什么业务。
业务逻辑被拆分成实现具体功能函数,不同函数处理不同的问题(输入数据格式校验,格式检查)
边栏推荐
- Erreur de hauteur du clavier souple
- 2022 test question bank and simulation test of tea master (primary) operation certificate
- Connect timed out of database connection
- 力扣每日一题-第32天-1822.数组元素积的符号
- 【无标题】
- golang中的正则表达式使用注意事项与技巧
- Source code analysis of open source API gateway APIs IX
- Learn the knowledge you need to know about the communication protocol I2C bus
- Deep learning systematic learning
- Tupu software has passed CMMI5 certification| High authority and high-level certification in the international software field
猜你喜欢
【刷题】字符统计【0】
【无标题】
postgresql源码学习(26)—— Windows vscode远程调试Linux上的postgresql
Day5: scanner object, next() and nextline(), sequential structure, selection structure, circular structure
window c盘满了
Office365 - how to use stream app to watch offline files at any time
【网站架构】一招搞定90%的分布式事务,实打实介绍数据库事务、分布式事务的工作原理应用场景
Conscience Amway universal wheel SolidWorks model material website
Aardio - Shadow Gradient Text
What information does the supplier need to know about Audi EDI project?
随机推荐
2022 tea master (intermediate) recurrent training question bank and answers
[untitled]
Connect timed out of database connection
AArdio - 【问题】bass库回调时内存增长的问题
LSTM of RNN
【批处理DOS-CMD命令-汇总和小结】-Cmd窗口中常用操作符(<、<<、&<、>、>>、&>、&、&&、||、|、()、;、@)
PostgreSQL source code learning (26) -- windows vscode remote debugging PostgreSQL on Linux
程序员养生宝典
The database is locked. Is there a solution
【网站架构】一招搞定90%的分布式事务,实打实介绍数据库事务、分布式事务的工作原理应用场景
Missing API interface actual development series (14): ID card real name authentication verification
Soft keyboard height error
[website architecture] solve 90% of distributed transactions in one move, and introduce the working principles and application scenarios of database transactions and distributed transactions
Access报表实现小计功能
Source code analysis of open source API gateway APIs IX
[batch dos-cmd command - summary and summary] - Common operators in the CMD window (<, < <, & <,>, > >, & >, & >, & &, ||, (),;, @)
Gdip - hatchbrush pattern table
Eigen matrix operation Library
empirical study and case study
Tupu software has passed CMMI5 certification| High authority and high-level certification in the international software field