思考-写怎样的代码看着舒服(Java/Kotlin)
看整齐条理的类文件代码 真的会少几条皱纹 在想写怎么样的代码会舒服 深思熟虑问过各家AI后进行整合编码约定 目前对应代码量比较多的是Java\Kotlin, 算是阅读量和编写量最多的语言, 汇总如下 Java Class Layout属性变量 静态/常量变量 私有/公共成员变量(非静态变量)构造 构造方法方法 单例方法(如果有) 公共/私有方法(非静态) 静态方法内部类 静态/内部类(如果有) Kotlin Class Layout https://kotlinlang.org/docs/coding-conventions.html#class-layout Property declarations and initializer blocks属性声明和初始值设定项块 Secondary constructors辅助构造函数 Method declarations方法声明 Companion object伴随对象
Kotlin Exception Handling
1. 普通处理异常 这种是普通的写法,明了的处理异常Kotlin也支持多个catch捕获 1234567891011try { throw Throwable("Diy Exception")}catch (e: Exception) { print("Exception-> ${e.message}")}finally { print("finally")} 2. inline模式处理异常 封装处理不会导致程序异常终止, 易于使用, 提供代码质量和开发效率吐槽一点 kotlin 不支持异常检查很不好, 需要人去识别可能出现的各种异常, 在对接各类功能接口很容易被忽略异常 1234567891011121314151617181920212223fun main() { var p = Person() p.name = null nameCatch(action = { ...
Flutter 记录
check 环境 1flutter doctor 同意 Android 协议 1flutter doctor --android-licenses
Android Scrcpy Frp 远程操控/调试Android手机
1234567891011121314151617181920212223242526272829303132333435361. 安装msys2https://www.msys2.org/2. 安装环境参考文档https://blog.csdn.net/u012787710/article/details/130430216pacman -S mingw-w64-x86_64-SDL2pacman -S mingw-w64-x86_64-ffmpegpacman -S mingw-w64-x86_64-libusbpacman -S mingw-w64-x86_64-makepacman -S mingw-w64-x86_64-pkg-configpacman -S mingw-w64-x86_64-meson3.pwdgit clone https://github.com/Genymobile/scrcpy.git4.# 进入代码仓cd./ scrcpy/# 编译scrcpy-server 如果慢 跳过 下载编译好的 https://github.com/Genymobil...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post1$ hexo new "My New Post" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generate More info: Generating Deploy to remote sites1$ hexo deploy More info: Deployment
