Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# Modular Application

Status
Not open for further replies.

boanrb

Programmer
Mar 3, 2009
53
KE
Hello Friends,

I am moving from Microsoft Visual Foxpro towards C#. I am still in the learning process, gathering some 'best practices' to grant me a good foundation.

After I am comfortable with my learning I intend to start migrating my numerous Foxpro applications to C#/MsSQL.

My dilemma:

In my Foxpro development I have the main application called MAINAPP.EXE. Within this application there are menu items that call specific modules eg. DEBTORS.APP, CASHBOOK.APP, PAYROLL.APP.

These .APPs are complete modules doing specific functions. They are compiled separately but they run under MAINAPP.EXE as they are called.

My question may be vague but I am looking for directions on how to implement the same structure in a C# application. Any links, information will be highly appreciated.

Thanks in advance.

Benson
 
Welcome to the C# world. Jump in. The water is just fine.

When you structure your project, add folders to your Visual Studio solution for each those areas, so you'll end up with folders for Debtors, Cashbook, Payroll, etc. Each will then get compiled to its own DLL.

Craig Berntson
MCSD, Visual C# MVP,
 
Hi Craig,

Thanks for welcoming me!

The modules have a GUI. Will they really work if compiled as a DLL? Again friend, I am still navigating the uncharted waters, so my questions may appear quite uninformed, but I must learn. Any helpful information will be highly appreciated.

Benson
 
No GUI in a DLL was an artificial limitation imposed by VFP. It was there because the DLL libraries didn't have any UI code in them.

There is nothing stopping you from doing it in .Net.

Craig Berntson
MCSD, Visual C# MVP,
 
I did not know this. New knowledge to me. And this is considered 'good practice'? Thanks again.
 
To elaborate a bit...

If the project needs to be highly modular, you'll probably want to create interfaces that define the pattern that modules need to use. That way the modules can be compiled as DLLs which use the interface, but don't have to know anything else about about the main application beyond whatever hooks you provide it.

Then, once its all done, you can make the main application scan the directory for DLL files, when it finds one, check to see if it is of the interface type that defines modules, and then load it. This way you end up with a system where the modules are now plugins, independent of the main program (and its very easy to simply drop in a new DLL when you need to extend functionality). Plus, it also provides an easy path for other developers to extend your program later on; they don't have to understand how the main applications does things, they just have to know how the subset that lets them interface works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top