外观模式和管理器类

发布于 2025-01-08 07:20:34 字数 273 浏览 5 评论 0原文

http://developer.android.com/guide/basics/what-is -android.html 请参阅 Android 架构。

我们是否可以考虑不同的管理器,例如不同子系统的外观对象。 例如,我们可以将资源管理器视为所有资源子系统的外观对象吗?

或者管理者为班级命名可能有不同的目的?

http://developer.android.com/guide/basics/what-is-android.html
See Android Architecture.

Can we consider different managers like facade objects for different subsystems.
For example,can we consider Resource Manager like a facade object to all resources subsystem?

Or maybe managers name for classes have different purposes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

昨迟人 2025-01-15 07:20:34

我想说这应该根据具体情况进行区分,答案往往是否定的。让我解释一下原因。

这四个人将外观定义为某些系统的特定入口点,该系统本身没有任何功能,但为子系统提供了一个简单的接口而不删除对该子系统的访问

现在,让我们看一下,例如 android.content.res。资源。确实是统一的接口,但是我们能不使用它就获取资源吗?不,这是不可能的:它使用了程序员无法使用的 android.content.res.AssetManager 方法。因此Resources并没有真正简化对其他东西的访问,这个类是资源系统不可分割的一部分。这意味着该类不能被视为
正面。

类似 android.view.animation.AnimationUtils 的类,位于相反,是一个门面。它不会做任何开发人员自己做不到的事情。然而,开发人员可以更轻松地调用此类的方法之一,而不是手动解析 XML 文件和创建动画类。它代表动画子系统的一些默认用途,而无需删除对系统本身的访问。因此,它完全有权利被称为门面。

I would say this should be distinguished on case by case basis, and the answer will often be "no". Let me explain why.

The gang of four defined facade as a specific entry point to some system which doesn't have any functionality on its own, but provides a simple interface to the subsystem without removing the access to that subsystem.

Now, let's have a look at, for example, android.content.res.Resources. It really is a unified interface, but can we get the resources without using it? No, it's not possible: it uses methods of android.content.res.AssetManager which are not available to the programmer. Therefore Resources does not really simplify access to something else, this class is an inseparable part of the resources system. This means that this class can't be considered a
facade.

A class like android.view.animation.AnimationUtils, on the contrary, is a facade. It doesn't do anything a developer couldn't do himself. However, instead of parsing XML files and creating animation classes manually it is easier for a developer to call one of the methods of this class. It represents some default uses of the animation subsystem without removing the access to the system itself. Therefore, it has the full right to be called a facade.

杀お生予夺 2025-01-15 07:20:34

我认为你的反思方向是正确的。例如,Android框架中有一些XXXManager类,它允许您使用指定的系统:偏好系统、搜索系统、应用程序包系统等。

我们可以将所有此类视为Facades。另一方面,它们提供了更具体的对象,我们应该使用它们来对系统进行更改。

You reflect in right direction, I think. For example there are some XXXManager classes in Android Framework which allows you to work with specified system: preference system, search system, application packages system and etc.

And we may to perceive all of this class like Facades. Another hand they provide more concrete objetcs which we should use to make changes in the system.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文