Programming Modular software

I was faced with a small problem; I want to create modular software.

Let me make it more general and not specific to my case. What I want to build is a software that loads a DLL and that DLL adds functionality to the software.

Think of a DLL like xvid, divx or some additional codec for your favorite video player. I want a more customized modular program, although in my case I am building software to handle customers, invoices and products, and different users may have different needs and so I need to deal with it somehow!

However, recompiling the software and specifically sending new files to every other user is "silly", I would rather create modular software (don't really know if that's the right term).

So I thought I was starting to create a sample that my DLL should follow.

Then I create a module handler in my software that loads the executing DLL and calls a method in it (here where the template comes in!).

What I would like to know, Am I on the right track?

Can you guys give me some guidance or examples on this?

This is all in C #, but of course it would be interesting to see how it differs in Java, Python or C ++ too.

0


a source to share


3 answers


You must have a goal. You either need a module to conform to some kind of interfaces, or something that the application can handle (like a method with a known attribute that you find through reflection). The interface then performs well-known functions such as invoice creation, invoice printing, etc.

Alternatively, your application must conform to some interface and use hooks for a module that will be used to inject itself into your application.



Plugins would be good for something that can be sliced ​​easily (media codecs). Hooks would be good for something with a well-defined event model (like a web server). What you use depends on how you want your modularity for clients, accounts, etc. She worked.

+2


a source


create a common IMyInterface for your classes that should include everything that is common to all of your Modals. You should learn Managed Extensibility Framework I believe you can get it from Codeplex .



+3


a source


Here's a similar SO thread . Here is a list of the dependency injection framework , Microsoft Unity . Alternatively, you can take a look at the Enterprise Library Codebase to see how they implement their vendor architecture, for example, in Cache App Block , where you can plug in your own caching provider.

0


a source







All Articles