this is pretty simple class that does what it' supposed to do but we have to wonder what the programmer was thinkingusing specifically formatted string instead of using python' incredibly useful built-in datetime library as conscientious programmers who reuse code whenever possiblemost of the programs we write will interact with datetime objectsnot strings we have several options to address this scenariowe could rewrite the class to accept datetime objectswhich would probably be more accurate anyway but if this class had been provided by third party and we don' know or can' change its internal structurewe need to try something else we could use the class as it isand whenever we want to calculate the age on datetime date objectwe could call datetime date strftime('% -% -% 'to convert it to the proper format but that conversion would be happening in lot of placesand worseif we mistyped the % as %mit would give us the current minute instead of the entered monthimagine if you wrote that in dozen different places only to have to go back and change it when you realized your mistake it' not maintainable codeand it breaks the dry principle insteadwe can write an adapter that allows normal date to be plugged into normal agecalculator classimport datetime class dateageadapterdef _str_date(selfdate)return date strftime("% -% -% "def __init__(selfbirthday)birthday self _str_date(birthdayself calculator agecalculator(birthdaydef get_age(selfdate)date self _str_date(datereturn self calculator calculate_age(datethis adapter converts datetime date and datetime time (they have the same interface to strftimeinto string that our original agecalculator can use now we can use the original code with our new interface changed the method signature to get_age to demonstrate that the calling interface may also be looking for different method namenot just different type of argument