Modular Programming

Posts   
 
    
davisg avatar
davisg
User
Posts: 113
Joined: 27-Feb-2005
# Posted on: 22-Jul-2005 14:27:51   

I am writing a client application and I want functionality within the application to be switched off/on depending on how it is licensed. For arguments sake lets suppose this application is an accounting system and the functionality I am referring to are the modules of an account system, General Ledger, Purchase Ledger and Sales Ledger. The license file would tell the client which modules can be accessed.

I really don't want the client to incorporate all the forms, reports and code for every module as I am thinking that the 'exe' would be too complex and way too big.

What I was thinking is there a way I can incorporate all the forms, reports and code into a module file for instance, maybe a dll which the client application would try and load depending on the license file? menus, forms and reports would then be dynamically loaded into the main client application view area.

Has anybody else had this kind of experience or could point me in the direction?

Cheers,

Geoff.

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 22-Jul-2005 18:26:25   

We have a similar requirement, and, while it hasn't been fully implemented yet, we've got some architecture for the main functionality elements.

Basically, you'll want to look at a basic plugin architecture. Create interfaces for each of the elements that you want dynamically loaded (menus, commands, reports, etc). Then use reflection to load the assemblies in a given directory and scan for implementations of those interfaces. Use some sort of hash to check whether a given assembly can be loaded based on the license, and ensure that each of your major functionality groups (modules) are separated into different assemblies.

Encapsulate each of the core functions ("New Journal Entry", "New Invoice", etc) into some form of "process object", and you should be able to attach security information to it, including whether or not the license allows the command to be executed. This will also give you the beginnings of the Command Pattern.

Hope that helps. simple_smile

Jeff...

davisg avatar
davisg
User
Posts: 113
Joined: 27-Feb-2005
# Posted on: 22-Jul-2005 18:36:14   

Jeff,

Many thanks.... theres a lot to look into there but this will definately come in handy. simple_smile

Geoff.