DTO的命名约定
DTO's naming convention
可能这是一个简单的问题,但我不清楚哪个是 dto 的 classes 和包的最佳命名约定,就包名称而言,大写 DTO 或 classes 的 Dto,等等....例如:
1.包名:
xxx.dto.animal.Dog.class 或 xxx.animal.Dog.class
2。大写 dto Class 命名约定:
DogDTO 或 DogDto
3。混合两个 dto 的约定或两者都不混合。
问题是,如果我可以将 'dto' 词声明为一个包,或者 'dto' 词必须包含在 class 名称中,或者这两种情况。
尽量避免在 class 名称中使用 DTO 后缀。在包名中包含 DTO 即可。
你只需要决定如何在包名中使用它。通常,我更喜欢my.feature1.dto
,例如my.feature2.dto
。
DTO 是一个非常简单的 class 所以应该不难识别 class 是 DTO。
可能这是一个简单的问题,但我不清楚哪个是 dto 的 classes 和包的最佳命名约定,就包名称而言,大写 DTO 或 classes 的 Dto,等等....例如:
1.包名:
xxx.dto.animal.Dog.class 或 xxx.animal.Dog.class
2。大写 dto Class 命名约定:
DogDTO 或 DogDto
3。混合两个 dto 的约定或两者都不混合。
问题是,如果我可以将 'dto' 词声明为一个包,或者 'dto' 词必须包含在 class 名称中,或者这两种情况。
尽量避免在 class 名称中使用 DTO 后缀。在包名中包含 DTO 即可。
你只需要决定如何在包名中使用它。通常,我更喜欢my.feature1.dto
,例如my.feature2.dto
。
DTO 是一个非常简单的 class 所以应该不难识别 class 是 DTO。