mercredi 6 septembre 2017

Design Pattern for User to choose Movie

I need general advice in process of designing solutions.

My general thought process is:

1.Define the required functionality in interface and make a class to extend the interface.

lets say a User has to log in into some Cinema site.then

then we need
//id,password,address,name,age,sex etc of User

//login method which authenticates the log in


//default Display of Movies after login

//Displaying the list as per the chosen type (select the choices of "TRENDING","MYTHOLOGY",ACTION" Movies).

Doubt:

So i define a class like this

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);
}

}

...

In this design,I am having all the required objects like Authenticate,DisplayUi etc here. But in this way i may have to end up with mny objects in the user class(More like a Facade Pattern).

Is this the right way? Please suggest me ,if could be implemented in better way

Aucun commentaire:

Enregistrer un commentaire