当前位置:网站首页>初学者如何正确理解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 自定义布局,元素 , 通用网络请求逻辑,拆到那里?
还有协程用法,也是一知半解。 协程嵌套用法, 使用协程发起的网络请求和普通网络请求之间怎么控制时序,那个先执行后执行另一个。并行执行,嵌套写法
自己照葫芦画瓢写的协程嵌套代码,自己写起来就费劲,感觉越写越没底。主要是网络请求代码嵌套看起来并不优雅也不美观。
如何理解业务逻辑
功能逻辑:详细讲解该功能的逻辑。
交互逻辑:对页面之间的相互跳转进行说明。
视觉逻辑:对颜色,对图标的要求。
业务逻辑:讲一下该功能对应着什么业务。
业务逻辑被拆分成实现具体功能函数,不同函数处理不同的问题(输入数据格式校验,格式检查)
边栏推荐
- 【mysql学习笔记25】sql语句优化
- 【Redis】一气呵成,带你了解Redis安装与连接
- golang中的正则表达式使用注意事项与技巧
- QT -- 1. QT connection database
- 2022 Guangdong Provincial Safety Officer a certificate third batch (main person in charge) special operation certificate examination question bank simulated examination platform operation
- Contenttype comparison of all types
- php laravel微信支付
- [untitled]
- 力扣每日一题-第31天-202.快乐数
- Chinese font Gan: zi2zi
猜你喜欢
![[getting started] intercepting strings](/img/16/363baa4982408f55493057200bcba5.png)
[getting started] intercepting strings

How to use layui to display the data in the database in the form of tables

Five combination boxing, solving six difficult problems on campus and escorting the construction of educational informatization
![[staff] high and low octave mark (the notes in the high octave mark | mark range are increased by one octave as a whole | low octave mark | mark range are decreased by one octave as a whole)](/img/ff/ebd936eaa6e57b1eabb691b0642957.jpg)
[staff] high and low octave mark (the notes in the high octave mark | mark range are increased by one octave as a whole | low octave mark | mark range are decreased by one octave as a whole)

【无标题】

Instead of houses, another kind of capital in China is rising

5大组合拳,解决校园6大难题,护航教育信息化建设

Connect timed out of database connection

2022 electrician (intermediate) recurrent training question bank and answers

【批处理DOS-CMD-汇总】扩展变量-延迟变量cmd /v:on、cmd /v:off、setlocal enabledelayedexpansion、DisableDelayedExpansion
随机推荐
Saving db4i depth camera pictures with MATLAB
2022 tea master (intermediate) recurrent training question bank and answers
【Redis】一气呵成,带你了解Redis安装与连接
empirical study and case study
slice扩容机制分析
Missing API interface actual development series (14): ID card real name authentication verification
[untitled]
Access report realizes subtotal function
Office365 - how to use stream app to watch offline files at any time
数字转excel的字符串坐标
How to get a SharePoint online site created using the office365 group template
[getting started] enter the integer array and sorting ID, and sort its elements in ascending or descending order
038 network security JS
【力扣10天SQL入门】Day9 控制流
Conscience Amway universal wheel SolidWorks model material website
Wang Yingqi, founder of ones, talks to fortune (Chinese version): is there any excellent software in China?
php laravel微信支付
力扣每日一题-第32天-1822.数组元素积的符号
golang中的正则表达式使用注意事项与技巧
What information does the supplier need to know about Audi EDI project?