我正在构建一个新的应用程序,并且是域驱动设计的新手。我一直在读通过的文件,我已经成功地模拟大多数领域模型的,但我想了解两个查询一些建议:域驱动设计建模查询
我有两个域对象的频道和节目。我已经将这两者建模为实体,因为两者都可以独立访问。一个频道可以有一个节目列表,所以我把它作为频道的一个属性。我的查询是我应该如何填充程序列表。它是确定在ChannelService的getChannerById方法首先获得信道信息,然后调用ProgramService拿到的渠道如程序列表:
Channel { String channelId List <Program> programList } Program { String programId { } ChannelService { Channel getChannelById(String channelId) } ProgramService { Program getProgramById(String programId) List <Program> getProgramsByChannelById(String channelId) }
我有一个产品领域对象,但它的一些属性(如规格和兼容性)涉及相当耗时的操作。这些属性并不是一直需要的,因此可以将这些属性作为域对象的一部分并且具有在需要时填充这些属性的单独服务方法,
Product { String productId Specification specification List <Product> compatibleProducts } ProductService { Product getProduct(String productId); void getProductSpecifications(Product product); void getCompatibleProducts(Product product); }
任何意见将非常感谢。
感谢您的建议。 – Surjit