command design pattern by scala