interface GameRulesInputBoundary void moveSouth() end interface GameRulesOutputBoundary void moveSouthSucceed() end class GameRules implements GameRulesInputBoundary def init(GameRulesOutputBoundary outputBoundary) this.outputBoundary = outputBoundary end @override def moveSouth() # do business logic this.outputBoundary.moveSouthSucceed() end end ----------------------- interface LanguageInputBoundary void parse(message) end interface LanguageOutputBoundary void movementSucceed() end class ItalianLanguageOutputBoundary implements GameRulesOutputBoundary def init(LanguageOutputBoundary languageOutputBoundary) this.languageOutputBoundary = languageOutputBoundary end @override void moveSouthSucceed() this.languageOutputBoundary.movementSucceed("Movimento completato") end end class ItalianLanguageInputBoundary implement LanguageInputBoundary def init(GameRulesInputBoundary gamerules) this.gamerules = gamerules end @override def parse(message) if message == "muovi sud" gamerules.moveSouth() end end end ------------------------- interface TextDeliveryInputBoundary void read_message() end class ConsoleTextDeliveryInputBoundary implements TextDeliveryInputBoundary def init(LanguageInputBoundary inputBoundary) this.inputBoundary = inputBoundary end @override void read_message message = read_from_command_line inputBoundary.parse(message) end end class ConsoleTextDeliveryOutputBoundary implements LanguageOutputBoundary @override void movementSucceed(message) system.println(message) end end ------------ class main def init() LanguageOutputBoundary languageOutputBoundary = new ConsoleTextDeliveryOutputBoundary() GameRulesOutputBoundary gamerulesOutputBoundary = new ItalianLanguageOutputBoundary(languageOutputBoundary) GameRulesInputBoundary gamerules = new GameRules(gamerulesOutputBoundary) LanguageInputBoundary languageInputBoundary = new ItalianLanguageInputBoundary(gamerules) TextDeliveryInputBoundary textDeliveryInputBoundary = new ConsoleTextDeliveryInputBoundary(languageInputBoundary) while true textDeliveryInputBoundary.read_message() end end end