observer pattern tasks [task(user )task(user )task(user )for task in taskstask complete(print(userif __name__ ="__main__"main(this results in the same output as before this is already much better solution the evaluation now takes place in the objects where they are relevantwhich is closer to the rules contained in the objects callisthenics exercise hope little light went on for you in terms of the value of practicing these types of code callisthenics and how it serves to make you better programmer it still bothers me that the task handler is changed whenever new type of badge or credit or alert or whatever else you can think of is added to the system what would be ideal is if there were some sort of hooking mechanism that would not only allow you to register new sub-systems and then dynamically have their evaluations done as neededbut also free you from the requirement to make any alterations to the main task system the concept of callback functions is quite useful for achieving this new level of dynamics we will add generic callback functions to collection that will be run whenever task is completed now the system is more dynamicas these systems can be added at runtime the objects in the system will be decoupled even more task_with_callbacks py class task(object)def __init__(selfuser_type)self user user self _type _type self callbacks self userself user walletself callbacks extend(self user badgesdef complete(self)for item in self callbacksitem complete_task(self