业务开发代码如何简洁统一

01:01

不要重复遭轮子,引用可靠的工具包,例如 guava commons 系列、hutool 系列。

  • guava 系列
  • hutools 系列
  • commons 系列

MapUtils.getString Map 为空则返回指定的值。

函数式、流式编程、泛型

  • Vavr 系列

  • Try.of

  • Tuple,支持 2 -> 9 的元组

  • Case

  • streamex 增强的流处理

11:31

防御式编程。

  • Optional
  • Iterables
  • Objects.isNull
  • IterUtil
  • MapUtils
  • SpringUtils
  • Assert

17:53

设计模式的封装

  • 模板(抽象类实际上就是一个模板方式)
  • 门面(防腐层)
  • builder
  • step builder
  • pipeline(责任链)

24:05

隐藏细节,starter 隐藏细节

  • mapstruct
  • queryDSL
  • lombok @SneakyThrows
  • 自定义注解 @Convert @Mapper
  • Spi
  • EnableXXX 注入

28:28

  • 代码借鉴
  • bytebuddy 路由
  • netty pipeline
  • jooq dsl
  • Axon Framwork 国外一个领域驱动项目
  • Spring

29:56

命名统一性。

  • Model
  • VO
  • Request
  • Response
  • Aware
  • Processor
  • Holder