adapter pattern for this to workyou might need some sort of email service set up on your operating system postfix is good free option should you need it before we continue with the examplei would like to introduce two design principles that you will see many times in this book these principles provide clear guide to writing better code don' repeat yourself (drydesign principles like dry are guiding lights in the forest of problems and challenges you need to overcome in any software project they are little voices in the back of your headguiding you toward cleanclearand maintainable solution you will be tempted to skip over thembut doing so should leave you feeling uncomfortable when you have dark corners in your code where no one likes to goit is probably because the original developer did not follow these guidelines will not lie to youin the beginningit is hard it often takes little longer to do things the right waybut in the long runit is worth it in the gang of four book (the original tome on object-oriented design patterns)the two main principles proposed by the authors for solving common problems are as followsprogram to an interfacenot an implementation favor object composition over inheritance keeping the first principle in mindwe would like to change the way we get user data so that we no longer deal with the implementation of data fetching inside the emailsender class we want to move this part of the code out into separate class in such way that we are no longer concerned with how the data is retrieved this will allow us to swap out the file system for database of some sortor even remote microserviceshould that be required in the future separation of concern programming to an interface allows us to create better separation between the code that gets user details and the code that sends the message the more clearly you separate your system into distinct unitseach with its own concern or taskand the more independent of one another these sections arethe easier it becomes to maintain and extend the system as long as you keep the interface fixedyou are able to switch to newer and better ways of doing things without requiring complete overall of your