English 中文(简体)
间接程度外的任何具体利益
原标题:Any concrete benefits of extra level of indirection

请在底部考虑 Java印法。 大约由两个模块组成,一个是处理信息。 过滤器的好处是什么 信息模块中的更新功能方法?

目前,它只是出席过仪式的代表。 管道模块的所有方法。 一种影响我的想法是在过滤器内 2. 更新后使用的方法,即使用拖车。 所有这一切都可以在审判/副渔获物中总结。 这对我有利吗? 是否有其他好处可达到间接程度?

PS......。 我熟悉以下问题,并咨询了这个问题,并沿用了内部的联系,但现在我想在具体背景下回答,而不是更一般性的问题:。 间接程度解决每个问题:

function msgHandlers() {
    var scope
        ,msgs;

    return {
        SET_CONTEXT: function(context) {
            scope = context.scope;
            msgs = context.messages;
        }

        ,SUBSCRIBE_ALL: function() {
            me.subscribe(scope, msgs.FILTERS_UPDATE_SUCCESS, this.filtersUpdateSuccess);
            //me.subscribe(scope, msgs.FILTERS_UPDATE_SUCCESS, tpl.overwriteAll);
        }

        ,filtersUpdateSuccess: function(filterValues) {
            tplPanels().overwriteAll(filterValues);
        }
    }
}

function tplPanels() {
    var instances = {};

    return {
        locationInstance: function() {
            if (!instances.locationPanel) {
                instances.locationPanel = locationPanel();
            }
            return instances.locationPanel;
        }
        //more instances, etcetera
        ,overwriteAll: function(filterValues) {
            //do something useful
        }
    }
        //etcetera
最佳回答

这里的情况似乎是对界面的抽象,而不是间接的外层参照。

内部摘要有几个目的:

  1. To cause a piece of code to fit an interface required by one generic client or one client whose shape is out of your control.
  2. To cause a piece of code to fit an interface shared by multiple clients.
  3. To cause a piece of code to fit a maintainer s mental model by abstracting away implementation details.
  4. To cause a piece of code to fit an interface required by a planned (not just possible) future use-case.

如果你的系统中另一个模块已经与确定背景文件兼容的接口有不同的投入,那么,它就可贵,因为它使你的代码得以在上文(1)或(2)处插手。

如果你计划有多个供应商或消费者参与这一接口,那么,现在就能够使其符合接口,因为你已经把该守则放在记忆中:(4)。

If other modules are already structured this way, or if filtering is a common operation other modules use, then code maintainers can leverage that to learn your code quickly: (3) above.

如无申请,则自<代码>上填满日期> <代码>tplPanels don t,在界面摘要中没有价值。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签