Visual Basic > Visual Basic Forums > Visual Basic Language > Interface class: module or class item
Ask a questionAsk a question
 

AnswerInterface class: module or class item

  • Tuesday, November 03, 2009 3:41 PMDevDells Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I am adding an interface class to a plug-in style application that already uses Reflection to provide access to .dlls (the 'plug-ins)
    I've found some good examples including this walkthrough on MSDN. http://msdn.microsoft.com/en-us/library/cd43d244.aspx
    Right from the beginning, it has you building your Interface in a module, and then adding a simple class that implements the Interface. I'm okay with that as I understand that a module is just a class object that is globally available and does not 'instantiate.'

    So, for my architecture I am thinking I will do the following.
    - create a project with just the Interface class (in a module) to compile to a .dll
    - create a separate project, the Plug-in, which implements the Interface
    - using Reflection in the main EXE, find and load the Plug-in if it implements the required Interface

    Does this fit into a 'best practice' for using an Interface class, and Reflection, to achieve the Plug-in architecture?
    The project is only being deployed as a single instance, stand-alone application on one computer. No 3tier, MVC, or even client-server considerations here.

Answers

  • Wednesday, November 04, 2009 7:31 AMYichun_FengMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi DevDells,

     

    Welcome to MSDN forums!

     

     

    The design of your projects depends on your requirement.

    If you want to compile the interface into a dll file, the client only sees the abstract interface, and the actual class object could be any class that implements that interface. This enables the client to load whatever DLL it wants and polymorphically treat the interfaces it receives from them as the same. This method is very powerful and elegant since.

    You can refer to this article for more information,

    http://www.gamedev.net/reference/articles/article928.asp

     

    When the dll client has right to access the content of dll files or your plug-in project is not that complex to use multiple references, you can consider compiling the interfaces and implements together into a dll.

     

    The last two points that your posted are the usual way that we choose in plug-in development.

     

     

    If you have any questions or concerns, please update the thread and we will have a further discussion.

     

    Have a nice day!

     

    Best Regards

    Yichun Feng

    MSDN Subscriber Support in Forum 

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Wednesday, November 04, 2009 2:43 PMJoao S Cardoso Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Also... I strongly recomend that you take a look at MEF.

    http://code.msdn.microsoft.com/mef

    Please remember to mark the replies as answers if they help you.
  • Wednesday, November 04, 2009 5:03 PMRudedog2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Try to get a hold of a copy of "Visual Basic 2005: The Language " from Microsoft Press.
    It contains a detailed example of a "plug-in" architecture framework.

    Mark the best replies as answers. "Fooling computers since 1971."

All Replies

  • Wednesday, November 04, 2009 7:31 AMYichun_FengMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    Hi DevDells,

     

    Welcome to MSDN forums!

     

     

    The design of your projects depends on your requirement.

    If you want to compile the interface into a dll file, the client only sees the abstract interface, and the actual class object could be any class that implements that interface. This enables the client to load whatever DLL it wants and polymorphically treat the interfaces it receives from them as the same. This method is very powerful and elegant since.

    You can refer to this article for more information,

    http://www.gamedev.net/reference/articles/article928.asp

     

    When the dll client has right to access the content of dll files or your plug-in project is not that complex to use multiple references, you can consider compiling the interfaces and implements together into a dll.

     

    The last two points that your posted are the usual way that we choose in plug-in development.

     

     

    If you have any questions or concerns, please update the thread and we will have a further discussion.

     

    Have a nice day!

     

    Best Regards

    Yichun Feng

    MSDN Subscriber Support in Forum 

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Wednesday, November 04, 2009 2:43 PMJoao S Cardoso Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Also... I strongly recomend that you take a look at MEF.

    http://code.msdn.microsoft.com/mef

    Please remember to mark the replies as answers if they help you.
  • Wednesday, November 04, 2009 5:03 PMRudedog2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Try to get a hold of a copy of "Visual Basic 2005: The Language " from Microsoft Press.
    It contains a detailed example of a "plug-in" architecture framework.

    Mark the best replies as answers. "Fooling computers since 1971."
  • Friday, November 06, 2009 6:06 AMYichun_FengMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi DevDells,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 

    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice day!

     

    Best Regards

    Yichun Feng

    MSDN Subscriber Support in Forum 

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.