Create an object outside a facade class, does it break facade pattern?
开发者_运维技巧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.
精彩评论