Strategy or A factory with Template Method



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.

Thanks & Regards
Ramesh

.