Using external libraries in C# to make program development easier
I've been working on a project for
about two weeks to help me handle customers and invoices.
Originally it was going pretty well
until I got to the point of adding invoice functionality. I had
already added customer management but the idea of adding invoicing to
my existing mess of code didn't seem too appealing.
I thought about it for a bit and
realized it would be really nice if I could build simple external
components and add them to my program as needed. That way I could
keep major parts of the program separate. This would allow me better
organization and management of my code. So I started exploring the
idea of external Dynamic Link Libraries or DLLs.
I did a bit of research of ways to add
external libraries and the option I decided to use would allow me to
write libraries for my program without the need of any source code
from the main program.
So I wound up scrapping what I had
already done and I wrote a main program to handle some primary
functions. Then I created a contact management library the the main
program loads when it runs.
It turned out to be easier than I
thought. One really cool feature was the ability of the main program
to pass objects and classes to the library, in essence, exposing only
specific functions in the main program to the library.
As long as I maintain persistence in
how database, printing and other primary functions are accessed I
wouldn't have to worry about those things when I wrote a new
component as they're already taken care of.
This eliminates the worry of, “How am
I going to implement these tedious but necessary things when I have
an idea for a new component?” I can focus on what I want the
component to do.
Comments
Post a Comment