views:

28

answers:

1

Our system would like our clients to link their accounts with different social media sites like youtube, vimeo, facebook, myspace and so on.

One of the benefits we would like to give to the user is to transfer, update and delete files they have uploaded to our sites and transfer them to the social media sites mentioned above. this files could be videos, images or audio.

We started thinking about using a strategy pattern, as all of these sites share a common process ( authentication, connection, use the API to transfer/edit/delete the file ), but we soon realized that it may not work as me may want to use some of the extended functionality that is specific to each service (eg: associate a youtube video with a channel, or upload images to a specific album on facebook, and much, much more...)

My question is, what would be the best Structural Design Patter to use for this scenario?

+1  A: 

I would actualy split services that you try to connect your users to into groups like:

  • Video services
  • Photo services
  • IM services etc.

For each group you may have a common interface that you will implement. Of course, each social media site can have several interfaces. Also I would add a special extention points to those interfaces that will allow you to reuse something that is specific for each site.

For example, in standard form you will use this method:

videoService.upload(chanel, playlist, file) 

If site supports something special that you can't put into common interface, then call it with extended properties:

if (videoService.getSiteName() == "YouTube") {
   videoService.upload(chanel, playlist, file, extendedProperties) 
}
Superfilin