关于java领域建模疑惑
最近有一个重构项目的任务,原项目的领域实体对象的一些动态属性采能了Map数据结构来实现,数据库表结构采用冗余字段,大致如下:
class Animal {
String name ;
Map<String,Property> prop = new HashMap();
}
class Property{
private String stringValue;
private Double doubleValue;
private Integer intValue;
private Long longValue;
private BigDecimal decimalValue;
private Boolean booleanValue;
}
-------------------------------------------table_property--------------------------------------
stringValue | doubleValue | intValue | longValue | decimalValue | booleanValue|
---------------------------------------------------------------------------------------------------
aaaa | | | | |
---------------------------------------------------------------------------------------------------
| | | 5 | |
---------------------------------------------------------------------------------------------------
同事对这个种实现不满意;请大牛针对这种实现给点意见;
同时同事对java类中新增一个field需要重起,决定改用Python开发,请大牛给点意见;