Example of factory and interface pattern