在包内部,我必须使用外观模式(或类似的东西)?
我使用 Facade 来访问包内的方法和类,但是包内的方法和类呢?我必须直接或通过外观或类似的东西访问其他类的方法?
示例:Package 1(Class Foo, Class Bar, Facade FooBar)
外部类 -> FooBar--> Foo 方法
但内部:
Foo --> Bar
或 Foo --> FooBar-->酒吧
I'm using a Facade to access the methods and classes inside package, but and inside the package? I must access the methods of other class directly or by a facade or something similar?
Example: Package 1(Class Foo, Class Bar, Facade FooBar)
Outside Class -> FooBar --> Foo method
but inside:
Foo --> Bar
or Foo --> FooBar --> Bar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
外观是一个单一的界面,可以轻松访问幕后发生的所有功能。它与将组件之间的内部功能从系统传回(并通过接口传回系统)的要求不同。
外观是控制面板,它们简化并隐藏内部组件,以便外部用户不会迷失在界面背后的复杂性中。具有内部组件的界面可以返回外部并通过界面操纵自身,这将是一个很好的艺术演示,但会是一个糟糕的外观,因为它会暴露它试图隐藏的东西。
不
或者在你的情况下
就可以了。
A facade is a single interface which allows easy access to all the functionality going on behind the scenes. It is not the same thing as a requirement to pass internal functionality between components back out of the system (and back into it through the interface).
Facades are control panels, they simplify and hide the internal components so external users don't get lost in the complexity of what is behind the interface. An interface with internal components that reaches back outside and manipulates itself through the interface would make a good art presentation, but would be a lousy Facade, as it would expose that which is it trying to hide.
not
or in your case
would be just fine.