是否有经理人设计模式这样的东西?[英] Is there such a thing as a manager design pattern?

本文是小编为大家收集整理的关于是否有经理人设计模式这样的东西?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

是否有像管理器设计模式这样的东西来控制不同实体的交互方式?

这是针对环境,EnvironmentListener和实体课程的项目.

静态类,Environment,具有一个单个EnvironmentListener接口,该接口具有nextAction()方法,它只是连续地调用了游戏中的主循环,并且由于它是针对设计模式类,所以我可以简单地更改代码.

我需要允许实体被拖动,掉落,动画等.并认为我会使用不同的控制器来做到这一点.

我一直想知道要制作一个可以实现EnvironmentListener以及是否存在的模式的控制器管理器是个好主意.

控制器管理器将简单地通过控制器列表进行迭代并使用其呼叫功能.

推荐答案

听起来您正在追随 Mediator 模式 - 可以想到作为处理对象的"经理".

其他推荐答案

在许多系统中,经理也是子系统的外墙,在这种情况下,它更像是外观设计模式.

其他推荐答案

数据管理器是立面设计pastern的实现. 它将连接封装到数据库和事务范围. 它保留了所有负责的表格中的所有Daos或记录(懒惰或不懒惰),当他创建一个表格时,它将其连接到连接和交易. 它可以用作 singleton ,因此您可以与一位数据经理合作. 数据管理器可以使用缓存管理器来缓存从数据库中检索到的数据,如果问题是相同的请求,则可以从缓存返回结果.

本文地址:https://www.itbaoku.cn/post/627775.html

问题描述

Is there such a thing as a manager design pattern that controls how different entities interact?

This is for a project for which the Environment, EnvironmentListener, and Entity classes have been predefined by our professor.

The static class, Environment, has a single EnvironmentListener interface that has a nextAction() method it just continuously calls kind of like a main loop in a game and because it is for a design patterns class, i can't simply change the code.

I need to allow entities to be dragged, dropped, animated, etc. and thought i would do that using different controllers.

I've been wondering if it was a good idea to make a controller manager which would implement EnvironmentListener and if a pattern like that existed.

The controller manager would simply iterate through a list of controllers and use their call function.

推荐答案

Sounds like you're after the mediator pattern - which can be thought of as a 'manager' of the objects that it deals with.

其他推荐答案

In many systems, a manager is also a facade for a sub-system, and in that scenario it is more of a facade design pattern.

其他推荐答案

Data Manager is the implementation of Facade design pastern. It encapsulate the Connection to the database and the transaction scope. It holds all the DAOs or Records (lazy or not lazy) of all the tables it responsible and when he creates one it connects it to the connection and transaction. It can be use as a singleton so you work with one data manager. Data Manager can use cache manager to cache the data that it retrieve from the database and if the same request is issue then it can return the result from the cache.