473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

C# Class Library - Plugin vs Inheritance!

Hi there,

I had some doubts on creatings plugins.

As most example on the internet shows how to write plugins onto a plugin
host which is normally a windows form program.

1) Can i replace plugin host as class libraries instead of windows forms
program?

2) If it is just a class library, then why plugins? I can just write an
abstract class and let the 3rd party inherit from it, and write something on
my class? Then why plugins, so complicated?

Can anyone enlighten me? I can't think what so special with plugin on this
case?

The major reasons is that i am developing a new framework (or many chunks of
libraries integrated into 1 namespace). Once it is done, i do not plan to
code anymore. If in future, whoever want to add functionalities to the
framework, just write plugins and plug into this framework. But i am kind of
mix up, and why can't i just write a new library and inherit from the
abstract class.

Example:

Framework
-------------
Parent abstrac class - Dad.cs
Child class inherit from parent - Son1.cs, Son2.cs, Son3.cs
(compiled into DadFramework.dll)

In future:
I had a new class - Son4.cs

public class Son4 : Dad
{
// had all Dad implementation
}

So why plugins again?

Please help! Thanks.
--
Regards,
Chua Wen Ching :)
Nov 16 '05 #1
2 2754
What do you mean when you say "plug-ins". A plugabble framework is
essentially one where the framework doesn't require compile time knowledge
of the concrete (non-abstract) classes as compile time.

In other words, the framework is implemented in terms of abtractions (I'd
argue that interfaces are better than abstract base classes for this as you
don't dictate an implementors base class when they can only have one). Then
other people create implementations of your abstraction and either:

1) they run their code into your framework
2) they advertize their new component via, say, a config file, and your
framework creates an instance (via Activator.CreateInstance), casts it to
the known abstraction and calls it.

number 2) is how the extension framework of ASP.NET and Remoting work

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

"Chua Wen Ching" <ch************@nospam.hotmail.com> wrote in message
news:54**********************************@microsof t.com...
Hi there,

I had some doubts on creatings plugins.

As most example on the internet shows how to write plugins onto a plugin
host which is normally a windows form program.

1) Can i replace plugin host as class libraries instead of windows forms
program?

2) If it is just a class library, then why plugins? I can just write an
abstract class and let the 3rd party inherit from it, and write something
on
my class? Then why plugins, so complicated?

Can anyone enlighten me? I can't think what so special with plugin on this
case?

The major reasons is that i am developing a new framework (or many chunks
of
libraries integrated into 1 namespace). Once it is done, i do not plan to
code anymore. If in future, whoever want to add functionalities to the
framework, just write plugins and plug into this framework. But i am kind
of
mix up, and why can't i just write a new library and inherit from the
abstract class.

Example:

Framework
-------------
Parent abstrac class - Dad.cs
Child class inherit from parent - Son1.cs, Son2.cs, Son3.cs
(compiled into DadFramework.dll)

In future:
I had a new class - Son4.cs

public class Son4 : Dad
{
// had all Dad implementation
}

So why plugins again?

Please help! Thanks.
--
Regards,
Chua Wen Ching :)

Nov 16 '05 #2
Chua Wen Ching <ch************@nospam.hotmail.com> wrote:
I had some doubts on creatings plugins.

As most example on the internet shows how to write plugins onto a plugin
host which is normally a windows form program.

1) Can i replace plugin host as class libraries instead of windows forms
program?
Yes, although obviously you'll need an executable *somewhere*.
2) If it is just a class library, then why plugins? I can just write an
abstract class and let the 3rd party inherit from it, and write something on
my class? Then why plugins, so complicated?


If you write an abstract class but don't have a plugin architecture,
how is the class library going to load your class?

The point of a plugin architecture is for an executable to load code
which was written later than it. If you're using a library for a new
executable, you don't need a dynamically loaded plugin architecture.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Franz Steinhaeusler | last post by:
Hello, (in wxPython) I want to redirect the SetStatusText to an own method (change the text somewhat) and then call the SetStatusText of wx.Frame. But I have a little problem of...
50
by: Dan Perl | last post by:
There is something with initializing mutable class attributes that I am struggling with. I'll use an example to explain: class Father: attr1=None # this is OK attr2= # this is wrong...
10
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is...
0
by: serge calderara | last post by:
Dear all, I have a library named Video.dll which provide certain vido functionnality as wel as menu and proprety using an interface. This library is working as a plugin Then I have my main...
17
by: Dave | last post by:
Hi I'm making a 3D Engine which consists of the class C3DEngine. Part of this engine is a file loader, a class called CMeshLoader. I have made an instance of CMeshLoader in C3DEngine, ie...
11
by: Sumit Nagpal | last post by:
Hi All, My application reads a 'Class' name (as a string) from a file at Run time. Can i create an instance this Class ? Thanks Sumit
9
by: Christian Kaiser | last post by:
Hmmm. I just got the following compiler messages: test_cpp.cpp d:\src\logsolar\datasources\test_cpp\test_cpp.h(18) : error C3760: please use __property keyword to declare property in managed...
5
by: petethebloke | last post by:
I'm not sure how to ask for what I want, so I can't find it on Google. I'll explain..... I have a class 'hanging' with a constructor: class hanging{ function hanging(){ }
5
by: Anthony P. | last post by:
Hello Everyone, I'm totally lost and I hope someone can help me out or point me to something that can. Here's the deal: I have an application that will implement a 'plugin' archetecture of...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.