montse
unread,Apr 23, 2011, 10:12:04 PM4/23/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to UBC CPSC 210
Hi,
Question 3 of the sample finals asks to choose a design pattern and
the solution suggests the Decorator Design Pattern. However, I'm
wondering if it would work if I use the output written to a file/
string as an object, and instead use the Factory Design Pattern. Where
I create two abstract classes: CompressedOutput and EncryptedOutput
which use the output of the Writer subclasses. Then, each Writer
subclass would have dependencies on subclasses of the abstract classes
(ie. CompressedOuptutString, EncryptedOutputString, same for file), so
that it is up to StringWriter and FileWriter to create either objects.
Thanks,
Montse