factory pattern in the barebones game we have set up so faryou could imagine the factory generating objects that contain play(methodwhich you could run in the game loop to play soundscalculate movesor draw shapes and images on the screen another popular use for abstract factories is to create factories for the gui elements of different operating systems all of them use the same basic functionsbut the factory that gets created gets selected based on the operating system the program is running on congratulationsyou just leveled up your ability to write great code using abstract factoriesyou can write code that is easier to modifyand code that can be tested easily summary when developing softwareyou want to guard against the nagging feeling that you should build something that will be able to cater to every possible future eventuality although it is good to think about the future of your softwareit is often an exercise in futility to try to build piece of software that is so generic that it will solve every possible future requirement the simplest reason for this is that there is no way to envision where your software will go ' not saying you should be naive and not consider the immediate future of your codebut being able to evolve your code to incorporate new functionality is one of the most valuable skills you will learn as software developer there is always the temptation to throw out all the old code you have previously written and start from scratch to "do it right that is dreamand as soon as you "do it rightyou will learn something new that will make your code look less than prettyand so you will have to redo everything againnever finishing anything the general principle is yagniyou will probably come across this acronym in your career as software developer what does it meanyou ain' gonna need itit is the principle that you should write code that solves the current problem welland only when needed alter it to solve subsequent problems this is why many software designs start out using the simpler factory methodand only once the developer discovers where more flexibility is needed does he evolve the program to use the abstract factoryprototypeor builder patterns