Type Casting and the Factory pattern

前端 未结 4 1416
执笔经年
执笔经年 2020-12-14 13:15

I\'m having a hard time figuring out how to implement a factory pattern in a DTO mapper I\'m trying to create. I\'m pretty sure I need to rethink my design. Here is a very s

4条回答
  •  [愿得一人]
    2020-12-14 13:37

    The factory pattern is best used when the objects differ in implementation, not interface. In your case the factory pattern is not too beneficial, and you are probably better off creating your objects directly (or some other pattern maybe better).

提交回复
热议问题