In this problem set we're going to expand upon our Mario application by refactoring to use the Factory Design Pattern.
- First, we're going to do some clean up on our Mario application. If you haven't already done so, refactor your code so that a Pyramid class encapsulates the functionality around creating a Pyramid.
- Next we're going to ensure that our application can only print Pyramids. Modify your printer classes so that they no longer print Strings, but accept Pyramids as arguments. (Hint, you might want to checkout the toString() method)
- Finally, implement the Factory Design Pattern to hide the instantiation of the Pyramid objects.
There's a book called Head First Design Patterns that does a great job of explaing how this pattern works and is implemented.
You can Head First Design Patterns in print on Amazon: http://www.amazon.com/Head-First-Design-Patterns-Freeman/dp/0596007124/ref=sr_1_1?ie=UTF8&qid=1401290803&sr=8-1&keywords=head+first+design+patterns
Or you can get it as an ebook with a free trial of Safari Books: https://ssl.safaribooksonline.com/trial
Videos coming this week.