开发者

Create an object outside a facade class, does it break facade pattern?

开发者 https://www.devze.com 2023-01-06 08:47 出处:网络
开发者_运维技巧In HomeCADEngine facade class I have a method \"addRoom(room:Room)\" and it will add this room to a ArrayList. But is it break facade pattern when we create a room outside facade class

开发者_运维技巧In HomeCADEngine facade class I have a method "addRoom(room:Room)" and it will add this room to a ArrayList. But is it break facade pattern when we create a room outside facade class and then pass it into addRom() method??


It depends. If Room belongs in your context (rather than the other one hidden behind facade), then it's a reasonable idea. If Room belongs in the other context, then you probably could use a factory or translator which builds objects used by the other system from primitive properties or objects from your system.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号