doulan4371 2010-08-08 16:12
浏览 41
已采纳

这是什么设计模式? (或者,您能为我的具体问题推荐一种模式吗?)

I have multiple Controller objects that either execute some script and then redirect to a specific page, or gather some data, send it to a View object and then display that View.

Instead of having a page for each controller instantiation (for example main_menu.php, image_browser.php, manage_users.php), I have an index.php page that contains a class which instantiates specified classes. The class to be instantiated is specified via URL GET variables when index.php is called. The class that manages instantiation checks if the specified class is in an array of allowable class names and, if it is, it instantiates the class (controller) and if it is not, it instantiates the MainMenu class.

Is this class that I have, which manages legal class names, a design pattern?

Or, is this not a design pattern?

  • 写回答

2条回答 默认 最新

  • douzhengnao8265 2010-08-08 16:25
    关注

    Sounds like a FrontController to me:

    The Front Controller consolidates all request handling by channeling requests through a single handler object. This object can carry out common behavior, which can be modified at runtime with decorators. The handler then dispatches to command objects for behavior particular to a request.

    See also:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行