Tech Off Thread

2 posts

How to Design a good library! I had 2 questions to ask.

Back to Forum: Tech Off
  • User profile image
    chuawenching

    I had 2 questions. I want to design a library like this below:

    MIND
    -> Chit Chat
    -> General Discussion
    ---------------------------> WenChing
    ---------------------------> Someone

    all of them are classes.

    1)

    Just say i sell this library to vendor A and wants to limit it to use WenChing class.

    Just say i sell this library to vendor B and wants to let them to use all the class.

    It depends on how much they pay us for the library - Enterprise edition, Standard edition, Professional Edition.

    I just want to use 1 dll to represent all this. I do not want to rewrite each dll to suit each vendor. Very troublesome.

    2)

    Just say i sell the library to vendor C, and they found out that in the library does not have a suitable function. I need to write a class that somehow understands it (maybe when you plug in a camera, it can understand the new branded camera and work with my dll).

    How do i achieve all this? I have limited experience to design libraries.

    Any tips?

    Thanks.

  • User profile image
    ZippyV

    1) Easy to do.
    You have to use a 'conditional compilation constant'. This is a constant that you define right before you compile, like 'standard', 'professional' or 'enterprise'. You can place such a constant in your Project properties box.
    In your code (I assume you use visual basic.net) you have to put if-statements with a # to check which constant you used:

    #If standard Then
       [place standard code here]
    #ElseIf professional Then
       [place pro code here]
    #ElseIf enterprise Then
       [place enterprise code here]
    #End If

    You can also use 'Else' if you want.
    For more information look in your help or MSDN for: Conditional compilation.

    2) You have to be more specific. Explain your situation, with this information I can't help you.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.