I would like to consult some piece of code with you. I have:
if tuple_type == Operation.START_SERVER:
dictionary = ServersDictionary()
dictionary.start(some_param)
elif tuple_type == Operation.STOP_SERVER:
dictionary = ServersDictionary()
dictionary.stop(some_param)
(...)
elif tuple_type == Operation.START_APP:
dictionary = AppsDictionary()
dictionary.start(some_param)
elif ...
(....)
And there I have 27 if / elifs. Normally, I would go into map - function dispatcher, but after every if / elif I have two lines of code with same dictionary reference. Would you suggest me some clean solution to replace those ugly constructions?
Creating 27 classes for applying polymorphism or 27 functions doesn't sound good... what do you think?
;'s if you really needed tosome_params different for all cases?