consoleobserver(ii attach( attach( product "gadgetgadget gadget this time when we change the productthere are two sets of outputone for each observer the key idea here is that we can easily add totally different types of observers that back up the data in filedatabaseor internet application at the same time the observer pattern detaches the code being observed from the code doing the observing if we were not using this patternwe would have had to put code in each of the properties to handle the different cases that might come uplogging to the consoleupdating database or fileand so on the code for each of these tasks would all be mixed in with the observed object maintaining it would be nightmareand adding new monitoring functionality at later date would be painful the strategy pattern the strategy pattern is common demonstration of abstraction in object-oriented programming the pattern implements different solutions to single problemeach in different object the client code can then choose the most appropriate implementation dynamically at runtime typicallydifferent algorithms have different trade-offsone might be faster than anotherbut uses lot more memorywhile third algorithm may be most suitable when multiple cpus are present or distributed system is provided here is the strategy pattern in umlabstraction user +someaction(implementation implementation +someaction(+someaction(