Java practice of MVC and factory