Re: Strategy or A factory with Template Method



"thinkmind" <ramesh.mandaleeka@xxxxxxxxx> wrote in message
news:1127822807.136760.66600@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> 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
>

Hi Ramesh,

First off, you need a factory either way, so seperate out the creation
pattern from the structural one.

Secondly, a few distinctions:



--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--


.



Relevant Pages

  • Strategy or A factory with Template Method
    ... I was going through some blogs on the net. ... void uploadFiles(Setfiles, boolean sftp, boolean scp, ...) { ... What the author of the blog says to use Strategy Design Pattern to ...
    (comp.object)
  • Re: OT but ...
    ... Facebook, blogs, etc. are perhaps only semi-public, but I can ... I'm not condoning this repression - I was a teacher ... the case we're talking about, the employer was asking for passwords, ...
    (alt.usage.english)