这个 "method linking" 对其他组件的(最佳)名称或描述是什么
What is the (best)name or description of this "method linking" to other components
首先,对于奇怪的"title"感到抱歉,但由于我不知道名字,所以很难用简短的句子来描述。
我以前来过这里很多很多次,但这是我第一次真正 activity。
我通常会搜索、阅读和努力寻找我想知道的东西。但是,这次我似乎无法得到我的答案,我觉得很可惜。
最近我读了 "Head First Design Patterns",我不记得里面有没有提到它。此外,我在框中打了很多 Google 个术语,但没有正确的定义。我只是找不到正确的搜索词组合来确定答案。
我对 "forward sharing / linking" 的正确名称有疑问
方法及其参数。
我正在编写 Java文档注释以使我的代码易于理解,但我无法获得适合此的正确术语或设计模式名称。
但只是问这个不会让我得到我想要的东西。所以我有一个小样本来尽可能地证明我的问题是基本的。我希望它有点理解。
public class Framework()
{
private Game game = new Game();
public Framework()
{
loadComponents();
}
public void loadComponents()
{
// first loading framework requirements.. (lets say a button graphic)
game.load(); // lets start loading the game....
}
public static void main (String[] args)
{
new Framework();
}
}
public class Game()
{
private World world = new World();
public void load()
{
// now we load some of the basic graphics.. (lets say a few borders)
world.load(); // lets start loading the world!
}
}
public class World()
{
private Textures textures = new Textures();
public void load()
{
// now we load the worlds grid...
textures.load(); // ofcourse we need textures, lets load...
}
}
public class Textures()
{
public void load()
{
// loading the textures...
// end of this loading link.
}
}
本例中我们从Framework开始,调用Game中的load方法,然后调用World中的load方法,
然后调用Textures中的load方法。让我们让它更简单一点:
Framework.load()->Game.load()->World.load()->Texture.load();
当然我们得到了更多这些"links"。
Framework.load()->Editor.load()->Entities.load();
Framework.input(输入输入)->Game.input(输入输入)->Player.input(输入输入);
Framework.draw(Graphics2D g2d)->Game.draw(Graphics2D g2d)->World.draw(Graphics2D g2d);
如何描述或称其为最好的 "chaining/linking"?因为 Java 中的链接就像:Player.getLocation().setLocation(12,12).etc();
我希望我的问题现在有点清楚了,
感谢您提前抽出时间!
- 埃德温
我相信这叫做 Delegator pattern
首先,对于奇怪的"title"感到抱歉,但由于我不知道名字,所以很难用简短的句子来描述。
我以前来过这里很多很多次,但这是我第一次真正 activity。 我通常会搜索、阅读和努力寻找我想知道的东西。但是,这次我似乎无法得到我的答案,我觉得很可惜。
最近我读了 "Head First Design Patterns",我不记得里面有没有提到它。此外,我在框中打了很多 Google 个术语,但没有正确的定义。我只是找不到正确的搜索词组合来确定答案。
我对 "forward sharing / linking" 的正确名称有疑问 方法及其参数。
我正在编写 Java文档注释以使我的代码易于理解,但我无法获得适合此的正确术语或设计模式名称。
但只是问这个不会让我得到我想要的东西。所以我有一个小样本来尽可能地证明我的问题是基本的。我希望它有点理解。
public class Framework()
{
private Game game = new Game();
public Framework()
{
loadComponents();
}
public void loadComponents()
{
// first loading framework requirements.. (lets say a button graphic)
game.load(); // lets start loading the game....
}
public static void main (String[] args)
{
new Framework();
}
}
public class Game()
{
private World world = new World();
public void load()
{
// now we load some of the basic graphics.. (lets say a few borders)
world.load(); // lets start loading the world!
}
}
public class World()
{
private Textures textures = new Textures();
public void load()
{
// now we load the worlds grid...
textures.load(); // ofcourse we need textures, lets load...
}
}
public class Textures()
{
public void load()
{
// loading the textures...
// end of this loading link.
}
}
本例中我们从Framework开始,调用Game中的load方法,然后调用World中的load方法, 然后调用Textures中的load方法。让我们让它更简单一点:
Framework.load()->Game.load()->World.load()->Texture.load();
当然我们得到了更多这些"links"。
Framework.load()->Editor.load()->Entities.load();
Framework.input(输入输入)->Game.input(输入输入)->Player.input(输入输入);
Framework.draw(Graphics2D g2d)->Game.draw(Graphics2D g2d)->World.draw(Graphics2D g2d);
如何描述或称其为最好的 "chaining/linking"?因为 Java 中的链接就像:Player.getLocation().setLocation(12,12).etc();
我希望我的问题现在有点清楚了, 感谢您提前抽出时间!
- 埃德温
我相信这叫做 Delegator pattern