Advanced usage of the factory method pattern