Re: Strategy or A factory with Template Method



Responding to Thinkmind...

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.

Implementing the Strategy pattern will be simpler. B-) All one is doing is selecting a particular behavior to execute based upon context. That sort of selection is exactly what Strategy does so implementing with Strategy would be simple and intuitive.


Perhaps a more basic response is to turn the question around: Why would one want to use a factory pattern here at all? There are no instances being created.


************* There is nothing wrong with me that could not be cured by a capful of Drano.

H. S. Lahman
hsl@xxxxxxxxxxxxxxxxx
Pathfinder Solutions  -- Put MDA to Work
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
(888)OOA-PATH



.



Relevant Pages

  • FTP/SCP/SFTP uploading - restrict access
    ... I want to create a system that allows a specific user to upload files via FTP, SFTP ... or SCP, but not to be able to view the files once they have been uploaded. ... For the FTP side, I am using ProFTP and have been trying to find documentation on the LIMIT ...
    (comp.os.linux.misc)
  • qestion about "scp" or "sftp"
    ... file using scp and sftp to the another computer via internet. ... it took me a very long to upload even a single file. ... I am connected to the internet with ADSL, and the person that I am ...
    (alt.linux)
  • Detecting sftp batch upload errors
    ... I am trying to write a script that will handle automated file ... transfers to and from an sftp server, ... When the upload is successful, ...
    (comp.security.ssh)
  • Re: Good sftp server?
    ... FDL on the files that I upload to convert it into STREAM_LF format. ... > it except for the sftp server, ...
    (comp.os.vms)
  • Re: Access control based on user and directory
    ... Also mount that data fs noexec so they can't upload programs and run them. ... If they upload a file from the laptop onto the server via SCP and the file has insufficient group permissions, would the default:group ACL specified in the parent directory take precedence over the standard "group" permission coming through SCP? ...
    (comp.os.linux.development.system)