How do I maintain two similar but different programs ?
Hi,
Sorry for the confusing title (but interesting I hope) !
I am developing an application for two companies that are 90% similar and different only in cosmetics (graphical elements of GUI), and some company specific customisations. These are mostly cosmteic but numerious in quantity.
Since the application is not 100% complete and not into test phase, I am expecting quite a number of changes in the code. Now how do I make sure that changes and improvements I made in one are not missed in another and at the same time or I do not have to repeat the same changes to another.
Is there any tool or any specific way of managing codes for this kind of scenario ?
TIA
Re: How do I maintain two similar but different programs ?
How large is the project?
One design methodology to implement this scenario is the n-trier model. This splits the application into layers - most usually interface-business logic-data. You develop all your non-gui functions in seperate libraries that can be linked to quite different User interfaces.
This is most often used on larger projects though.
You could just try farming out all your re-usable code to a seperate .dll and then link to a single version in you differing interfaces.
Failing that, you can share visual basic class and module files between projects - it's not ideal but it does mean that if you change it in one place it will be reflected in the other.
Just a few ideas for you.
Re: How do I maintain two similar but different programs ?
If this is just a desktop application there is of course no need to use the n-tier design. But you should always separate the GUI design from the internal logic. Put all the logic of the application in classes (which you of course can compile separately into a DLL, like Slaine suggested, if you like but you can also put each of the classes into each project as well). The GUI will now simply call the different methods and properties of these classes from where ever they should be called. Which might be from the main menu in one app, while the other calls a particular method from a dialog box or whatever.
Re: How do I maintain two similar but different programs ?
Ah, I should have done proper planning first !
Initially my goal was to get something working quick and dirty and it grew and grew !
So I'm afraid its all code mixed in the form events ! There are a lot of classes though (only what I've resued from others, what I myself did is all in forms !!)
I'd not expected to do it for multiple companies. Seems like I've got a lot of cleaning to do. Unless somebody can advise me another quick and dirty way to do things for now ;)
At least until I meet the deadline for now and re-organise the mess I created.
Re: How do I maintain two similar but different programs ?
Well, quick and dirty is fine, if you want a quick and dirty application. As you've noticed even a small app can quickly grow to a large project and the only way to get rid of the dirt is to clean it up :)
Re: How do I maintain two similar but different programs ?
Quote:
Originally Posted by Joacim Andersson
Well, quick and dirty is fine, if you want a quick and dirty application. As you've noticed even a small app can quickly grow to a large project and the only way to get rid of the dirt is to clean it up :)
This should be posted in the cubes of every programmer on the planet!
Re: How do I maintain two similar but different programs ?
One other way is to use conditional compilation. You write a block of code that certain parts will execute if the compilation variable is one value and execute another if its a different value, etc.
VB Code:
#If iCompany = 1 Then
'Blah, blah, blah...
#Else If iCompany = 2 Then
'Blah, blah, blah...
#Else
'Blah, blah, blah...
#End If
You can declare the compilation variable in the project properties under the Make tab - Conditional Compilation Arguments:
Re: How do I maintain two similar but different programs ?
Quote:
Originally Posted by RobDog888
You can declare the compilation variable in the project properties under the Make tab - Conditional Compilation Arguments:
Or directly in the code:However conditional compiler constants are always private to the module in which they are declared. Using this approach might be good if there are small differences in the code between the two different apps, but they aren't very useful to create different GUIs.
Re: How do I maintain two similar but different programs ?
Right but if you declare them in the project properties they are Public. It is a good way to keep different version of the same program if they are small changes. Just thought I would throw it out there as a means of initializing the change for his program. Easiest and fastest changes are always better when working against a budget. :)
Re: How do I maintain two similar but different programs ?
Thanks for the idea Rob. Didn't know that technique. Yeh that will be immensely helpful at some places of the proj I am working on.
But for others (esp the GUI), it seems I'll have to reorganise my things.