Alice52 / java-ocean

java-tutorial .We intend to explain Java knowledge in this repository.
MIT License
0 stars 0 forks source link

[common] model architecture #157

Closed Alice52 closed 3 years ago

Alice52 commented 3 years ago

controller

  1. controller should do and just do follow things

    • [x] convert vo to bo/po
    • [x] call service api
    • [x] convert bo/po to vo
    • [x] more: define model with JSR303

model

  1. POJO: Plain Ordinary Java Object

    PO: after a POJO is persisted
    DTO: directly using it to pass and transfer
    VO: directly used to correspond to the presentation layer
  2. VO: Value[View] Object, Serving the logic

  3. PO[Entity]: persistent object

  4. DTO: Data Transfer Object,

  5. BO: Business Object, combining PO

  6. JavaBean: Reusable Component

  7. DAO: Data Access Object

    POJO persist to PO
    comnine PO to VO or DTO
  8. DO: 高内聚的, OOP

    我们会发现领域对象(Order)存在的唯一目的其实是为了让ORM这样的工具能够一次性地持久化,在不使用ORM的情况下,领域对象甚至都没有必要存在

    Model 定义时就内聚相关 CRUD 方法

digram

image

reference

  1. DDD