Filip Ekberg
Filip Ekberg

Reputation: 36287

Programming Modular software

I stand in front of a little problem; I want to create a modular software.

Let's make it more general and not specific for my case. What I want to create is a software which loads dlls and those dlls adds features to the software.

Think of the dlls as xvid, divx or whatever additional codec, feature to your favorite video-player. I want a more custom modular program though, in my case I'm creating a software to handle Customers, Invoices and Products and different users might have different needs and therefore I need to handle this somehow!

However, re-compiling the software and specificly sending the new files to each different user is "stupid" I would rather create a modular software ( don't actually know if this is the correct term ).

So what I was thinking is that I begin creating a pattern of which my DLL's should follow.

Then I create a Module handler in my software which loads the actuall DLL and calls the method in it ( here's where the pattern come in! ).

What I'd like to know is; Am I on the right track?

Might you guys give me some pointers or examples on this matter?

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

Upvotes: 0

Views: 3268

Answers (3)

Muad'Dib
Muad'Dib

Reputation: 29216

create a common interface IMyInterface for your classes which should include everything that is common between all of your Moduals. You should look into the Managed Extensibility Framework I believe you can get it from Codeplex.

Upvotes: 3

Colin Burnett
Colin Burnett

Reputation: 11518

You have to have a purpose. You either need the module to conform to some kind of interface or something the app can handle (like a method with a known attribute that you find via reflection). The interface then performs known functionality like invoice creation, invoice printing, etc.

Alternatively your app has to conform to some interface and uses hooks for the module to use to inject itself into your app.

Plugins would be good for something that can be easily sliced up (media codecs). Hooks would be good for something with a well-defined event model (like a web server). Which you use depends on how you want your modularity for customers, invoices, etc. to work.

Upvotes: 2

JP Alioto
JP Alioto

Reputation: 45117

Here is a similar SO thread. Here's a list of dependency injection frameworks, Microsoft's is Unity. Also, you can look at the Enterprise Library codebase to see how they implement their provider architecture, such as in the caching application block where you can plug in your own caching provider.

Upvotes: 0

Related Questions