Re: Strategy or A factory with Template Method
- From: "Zorro" <zorabi@xxxxxxxxxxx>
- Date: 27 Sep 2005 23:05:03 -0700
Hi Group
> I was going through some blogs on the net. Here is one I am looking at.
> What's wrong with the following code?
void uploadFiles(Set<File> files, boolean sftp, boolean scp, ...) {
if (sftp) {
// upload via SFTP
} else if (scp) {
// upload via SCP
} else {
// upload via FTP
}
}
> What the author of the blog says to use Strategy Design Pattern to
implement this.
> But my question is cannot we use a Factory Design Pattern with a
Template Method. Which one is more appropriate. Can any one give me
idea on this.
Hi Ramesh,
I am not sure of the context. Is this intended to be method for a
class? Does the underlying language support enumeration?
Assuming that there could be a dozen protocols to support, it would be
better to pass the protocol as an enumeration, rather than a sequence
of booleans.
Hope this helps.
Regards,
zorabi@xxxxxxxxxxx
http://www.zhmicro.com
http://distributed-software.blogspot.com
http://groups-beta.google.com/group/computerlangZ?lnk=la&hl=en
.
- References:
- Strategy or A factory with Template Method
- From: thinkmind
- Strategy or A factory with Template Method
- Prev by Date: Really Stupid Question
- Next by Date: Re: Strategy or A factory with Template Method
- Previous by thread: Strategy or A factory with Template Method
- Next by thread: Re: Strategy or A factory with Template Method
- Index(es):