Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GameObject中应该避免存在PlantVsZombieView类的引用 #5

Closed
GoogleCodeExporter opened this issue Nov 19, 2015 · 1 comment
Closed

Comments

@GoogleCodeExporter
Copy link

在GameObject存在下面的定义:
protected PlantVsZombieView mView;
public void setView(PlantVsZombieView view) {
    mView = view;
}

我认为,应该解除GameObject与View之间的直接耦合关系。因为Gam
eObject是一个非常基础的、抽象的类。如果作为基础的类还依�
��于上层的具体类(非接口),这就破坏了基础类的独立性和
抽象性,使得程序的依赖关系变得复杂。

Original issue reported on code.google.com by liufengy...@gmail.com on 15 Nov 2010 at 2:37

@GoogleCodeExporter
Copy link
Author

这个问题提得好,是我最初遗留下来的待解决的问题,后来��
�的时候有时候记得要改最后又忘了改。确实类层次上抽象层�
��类只应该有与其他抽象层次的类或接口的依赖关系。现在已
经通过将成员变量改成GameEventListener的接口引用来避免直接与
PlantVsZombieView形成耦合关系。具体的更改参见最新的代码。如
果大强僵尸那边有受到相关影响的话也请做相应的更新。欢��
�大家继续针对设计上的问题提出审核意见!

Original comment by njuliu.z...@gmail.com on 16 Nov 2010 at 4:42

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant