command, factory and visitor pattern