开发者

Where about should my main class be created in a project?

开发者 https://www.devze.com 2022-12-29 01:35 出处:网络
The problem is where a class should be created in my code. An example is I have a UI class and a main logic class that controls other objects.

The problem is where a class should be created in my code. An example is I have a UI class and a main logic class that controls other objects.

Should the main logic class create the UI object, or sh开发者_如何学编程ould the UI object create the instance of the main logic class?

An explanation of which method is best and why would be ideal.

Thanks.


Neither.

I think controller classes should instantiate the UI.

Whether you have a driver that contains the main, or the controller owns it, is immaterial.

If you change UI, your app should still work fine. Don't put the main in the UI classes.

0

精彩评论

暂无评论...
验证码 换一张
取 消