banner
指数爆炸

指数爆炸

我做了对饭 !
github
bilibili

Explaining various data models in architectural design [PO, VO, BO, rich model ...]

When I encountered these messy data models, I was really confused. The architecture design was also a mess. I didn't know how to get the corresponding package name based on the data model. I searched various materials online, but no one explained it in a simple and understandable way. So, I organized it based on my own experience.

500

  • POJO【plain old java object】: Plain Java objects that can serve as the basis for other data models.
    • VO【value object】: Value objects are immutable objects with no unique ID identifier, used to represent a set of values.
      • Can contain simple business logic operations.
      • VOs typically override the equals and hashCode methods for value-based comparisons.
    • PO / Entity: Entities must have a unique ID identifier, meaning that if two entities have the same property values, they are not considered equal. PO is a Java object mapped to a database table.
    • DTO【data transfer object】: DTOs are used to transfer data between different layers.
      • Do not contain any business logic.
    • Rich Model: Rich Model = PO + Business Logic. If a PO contains business logic, then it is a rich model.
      • BO【Business object】: Business objects contain business logic and are only used in the Service layer.
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.