Customising Windows Application

Posted on 2014-02-20
Medium Priority
Last Modified: 2014-07-01
I have a windows application using MS SQL Server & windows clients written in vb.net. I need to heavily customise parts of it for a second customer which means we will have a vanilla flavour for one customer while the second will use some parts of the vanilla flavour and some parts will be customised to their requirements.

We think this is likely to be the pattern in the future where each new user needs a degree of customisation. I am not sure how to structure the project - I don't want two separate applications.

I am thinking of putting each user's bespoke code in a dll and keeping the vanilla code in the original exe but not having done this before I would like to know if this would work or if there is a better way.

Look forward to hearing from you all.

Question by:Paul-Brooks
  • 4
  • 2
  • 2
  • +2
LVL 23

Expert Comment

by:Michael Fowler
ID: 39872829
Personally I would do the reverse and have the vanilla code in the dll with all of the common methods available, this way you could reference it in each new instance you create and instantly have these methods available.

If you go this route have a look at ILMerge to combine the dll and exe files into one

Another idea to use would be leave the original code in place and use inheritance to create new classes that reuse, extend, and modify the behavior of the original classes


Author Comment

ID: 39873182
Hi Michael,

Maybe I am thinking about this the wrong way round but I am hoping to end up with one application which contains the core of the product (~80%). The other 20% is likely to be different for every user.

The application is fundamentally a stock system so the transaction processes look like they will be common but the types of the "stock" of each user are very different. Rather than expanding the characteristics of each stock type to cover all stock types I intended to break them up and allow each to have its own forms / updates or whatever but isolated from teh vanilla version.
LVL 83

Expert Comment

ID: 39874013
Can you tell us a bit more about what the difference will be between customers?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 40
ID: 39874787
We might be able to help more once you have answered CodeCruiser request. Splitting code between an application and a dll, with one of them customized, is often the best solution.

But there is an alternative, depending on the type of customization you want to do and the number of different customized versions, where everything can be done in only one application through the help of Configurations.

You could create a Configuration for each user. That means that in the Debug/Release configuration dropdown at the top of the screen, you would have extra entries, one for each customer.

In the Project's Advanced Compile properties, you define a Custom constant for each customer.

In your code, you work with #If, #Else and #End If the following way:

#If ConstantForCustomer1
   'Custom code for customer 1
   'Common non-customized code
#End If

When you select Customer1 in the configuration dropdown, only the code before the Else is compiled. You have a .exe for Customer 1. Otherwise, only the code in the Else is compiles, there is your standard version. It's easy to know what happens, because the code that will not compile is greyed out in the code window (unless you have an old version of Visual Studio, before 2008 if my memory is good).

Since by default, each configuration compiles in its own directory (bin\Release, bin\Customer1), its easy to manage the different versions.

If need be, complete modules, classes or forms can be treated that way.

In one file:

#If ConstantForCustomer1
    Public Class Form1
        'Customized form for customer 1
    End Class
#End If

In another file:

#If ConstantForCustomer2
    Public Class Form1
        'Customized form for customer 2
    End Class
#End If

The form has the same name, so it works with the common code, but the one that compiles for customer 1 application will be different than the one that compiles for customer 2.

If you have dozens of customers, this approach is usually less interesting than working with many solutions that share some of the code.

If you have only a few customers, that enables you to keep everything in only one solution.
LVL 85

Expert Comment

by:David Johnson, CD, MVP
ID: 39875591
Have you considered using resource strings?

Author Comment

ID: 39876280
The application is for managing industrial & commercial waste. It records the origin, the characteristics of the material and the disposal route. The origins & disposal routes are fairly straightforward - basically customers & suppliers and individual batch numbers per item or container provide traceability.

The difficultly is in defining the materials their characteristics, hazards, disposal restrictions and operator permissions. For a chemical business almost all their operators are permitted to book in and dispose of harmless materials but hazardous materials have to be further tested and classified then disposed of through specific routes and only by authorised users. The materials and their characteristics are fairly specific to the business's processes.

Contrast that with disposing of high value laboratory equipment which has a completely different set of items some of which might be taken apart to salvage high value scrap, particularly hazardous components or parts for resale.

Suppose we said each business needs around 10 characteristics (not all of which are used on every item) the for two versions I need twenty which isn't a problem but I can't let each see 10 characteristics they wont use. Usually there will be one characteristic responsible for the hazard (flammable solvent, asbestos lining, highly toxic additive, etc) but few will be found in more than one business unless we are lucky.

Hope this help, please ask for clarification if you wish.
LVL 83

Expert Comment

ID: 39876885
I would suggest that you define a few properties for material such as Name, Type/Category, Whether or not its hazardous etc and then use EAV(Entity Attribute Value; basically as many key/value pairs as you need) type model for storing any additional properties of the materials.

Author Comment

ID: 39877077
Storing the properties of materials isn't so much of a problem, it is behind the scenes and out of sight of users but the chemical company uses a list of about 15 properties to define all its waste types. The lab equip company looks like it might need 12 properties but these are different (apart from the name) to those needed by the chemical company.

The waste type maintenance screens are going to little in common and even the booking in screens which record details for actual batches are going to be different.

I don't really understand how the EAV model helps here but I am happy to listen.
LVL 40

Accepted Solution

Jacques Bourgeois (James Burger) earned 2000 total points
ID: 39877103
You have different properties for each type of businesses.

You have different screen for each type of businesses.

Application is different, data is different. There is not much in common there.

There could be some common classes defined in a dll that would be reused for all applications, such as the charts, spelling checker and toolbars/ribbons that of the Office.dll that is reused by all applications in the Microsoft Office Suite.

But apart from that, I see it as totally different applications.

Author Comment

ID: 39877190
Hi James,

I can't really afford to write a 'new application' for each customer so maybe I need to look harder at identifying what is common between them both and designing that as the "core product'.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question