3 Dependency Injection done

Run Settings
LanguagePython
Language Version
Run Command
class AbstractProcessor() : def __init__(self,data) : self.data = data def run(self) : pass class MsgProcessor(AbstractProcessor) : def __init__(self,data) : super(MsgProcessor,self).__init__(data) def run(self) : print('The message is: ' + str(self.data)) class AskProcessor(AbstractProcessor) : def __init__(self,data) : super(AskProcessor,self).__init__(data) def run(self) : print('The question is: ' + str(self.data)) class Runner() : def __init__(self,processor) : self.processor = processor def process(self) : if self.processor : self.processor.run() def main(argv) : try : runner = None if len(argv) > 1 : if argv[0] == 'msg' : # says 'the message is: <message>' runner = Runner(MsgProcessor(argv[1])) elif argv[0] == 'ask' : # says 'the question is: <message>' runner = Runner(AskProcessor(argv[1])) if runner : runner.process() except Exception as e : print('main: exception occurred ' + str(e)) if __name__ == '__main__' : try : argv = [] argv.append('msg') argv.append('is this a message') main(argv) except (SystemExit,KeyboardInterrup) : pass
Editor Settings
Theme
Key bindings
Full width
Lines