5 Replies - 333 Views - Last Post: 15 July 2011 - 05:35 AM Rate Topic: -----

#1 The Architect 2.0  Icon User is offline

  • D.I.C Regular

Reputation: 37
  • View blog
  • Posts: 351
  • Joined: 22-May 08

Plugins vs Updates

Posted 15 July 2011 - 12:25 AM

I'm trying to make a program that can access various social networking sites(facebook, twitter, linkedin, etc.). I definitely want to have the ability to add new networks after the program is released. That is what I need help with.

I'm just wondering what the appropriate 'architecture' is: give the program the ability to support plugins, or just include the new services through updates.

I know this is a stupid question, but I just want some sake of mind :). Some programs add services through updates while others use plugins. The obvious reason for plugins is so that the user don't have to disable 10,000 services they don't want to use, but is there any other reason why?

Is This A Good Question/Topic? 0
  • +

Replies To: Plugins vs Updates

#2 batesy3k  Icon User is offline

  • D.I.C Regular

Reputation: 41
  • View blog
  • Posts: 299
  • Joined: 10-September 09

Re: Plugins vs Updates

Posted 15 July 2011 - 12:46 AM

I guess that is a key point but doing it via the plugin method also keeps your application low-weight - i.e user's wouldn't have to donwload a large application containing services that they do not require compared to just downloading the appropiate plugins when they need them :)

Just my two cents :)
Was This Post Helpful? 1
  • +
  • -

#3 wiero  Icon User is offline

  • D.I.C Head

Reputation: 48
  • View blog
  • Posts: 78
  • Joined: 29-June 11

Re: Plugins vs Updates

Posted 15 July 2011 - 01:28 AM

i think using plugins gives better separatin of core and additional features. you colud use your friend help or even enable community to create own social networking plugins without full source distribution

This post has been edited by wiero: 15 July 2011 - 01:29 AM

Was This Post Helpful? 1
  • +
  • -

#4 The Architect 2.0  Icon User is offline

  • D.I.C Regular

Reputation: 37
  • View blog
  • Posts: 351
  • Joined: 22-May 08

Re: Plugins vs Updates

Posted 15 July 2011 - 02:07 AM

ah, right. thanks guys. I totally didn't even think about the community support part of it.

this brings up another issue...how exactly does one enable plugin support? I googled this already and i got alot of hits on Extension Object Pattern. It's been fairly confusing for me(mainly on what files actually get passed around, WHAT the files actually are - dlls? -, where they go, etc.).

ps, just to reclarify, my whole plugins vs updates thing is SPECIFICALLY about my case. I can see obvious reasons why you can't just make everything a plugin(or where it would be very awkward/bad to).
Was This Post Helpful? 0
  • +
  • -

#5 wiero  Icon User is offline

  • D.I.C Head

Reputation: 48
  • View blog
  • Posts: 78
  • Joined: 29-June 11

Re: Plugins vs Updates

Posted 15 July 2011 - 04:35 AM

i use very simple approach which i saw while resarching how to enable plugin support.

i've created simple dll with public api with interfaces which plugin should implement
pulic interface IPlugin 
{
public string Name { get; }
public string Version { get; }
// plugin methods
}


someone creates dll referencing your public dll
than loading plugins may look like this
//loading assemblies
foreach (string filePath in Directory.GetFiles(PLUGIN_FOLDER,"*.dll"))
{
  Assembly.LoadFrom(filePath)
}
List<IPlugin> plugins = new List<IPlugin>();


//creating plugin instances
foreach (var type in AppDomain.CurrentDomain
			.GetAssemblies().SelectMany(x => x.GetTypes())
			.Where(t => t.IsAssignableTo<IComponent>() && (t.IsClass && !t.IsAbstract)))
		{
// IPlugin must have parameterless constructor in this case
plugins.add(Activator.CreateInstance(type));
}


IsAssignableTo is extension method
public static bool IsAssignableTo<T>(this Type that)
{
 return typeof(T).IsAssignableFrom(that);
}


This post has been edited by wiero: 15 July 2011 - 04:35 AM

Was This Post Helpful? 0
  • +
  • -

#6 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2241
  • View blog
  • Posts: 9,412
  • Joined: 29-May 08

Re: Plugins vs Updates

Posted 15 July 2011 - 05:35 AM

Also you should consider using MEF.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1