0
我需要设计解决方案过程中的一般建议。用户选择电影的设计模式
我的总体思路过程是:
- 在接口定义所需的功能,使一个类来扩展接口。
比方说,用户必须登录到一些电影网站,那么我们就需要
// id, password, address, name, age, sex etc. of the User
// login method which authenticates the login
// default Display of Movies after login
// Displaying the list as per the chosen type (select the choices of "TRENDING","MYTHOLOGY", ACTION" Movies).
的疑问:
所以我定义一个类是这样的:
public class User implements IUSER {
private String id;
private String password;
private Authenticate authenticate;
private DisplayUI displayUI;
..
..
..
User()
{
authenticate = new Authenticate();
displayUI = new DisplayUI();
}
public String getUserName() {
return userName;
}
private String userName;
@Override
public void login() {
authenticate.verify(userName,password);
select("ACTION");
}
@Override
public void select(String Type) {
displayUI.display(Type);
}
}
...
在在这个设计中,我拥有所有必需的对象,如Authenticate,DisplayUi等。但通过这种方式,我可能不得不在用户类中得到很多对象(更像是一个Facade模式)。
这是正确的方法吗?请建议我,如果可以以更好的方式实施。
@ Kedar.Thanks Kedar。你可以请我建议书/网站,它给出了这样的例子,通过一个面向对象的设计过程的例子,这是非常互动的开发人员与真实填充的例子 –
@Shriharsha grv以下书是好的 - 1.面向对象的分析和设计与应用程序,通过Grady Booch。 2.使用UML进行面向对象的建模和设计,Michael R. Blaha,James R Rumbaugh。 Blaha管着你的视频。 –