Results 1 to 10 of 10

Thread: How do I maintain two similar but different programs ?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    38

    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

  2. #2
    Fanatic Member Slaine's Avatar
    Join Date
    Jul 2002
    Posts
    641

    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.
    Martin J Wallace (Slaine)

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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.

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    38

    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.

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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!

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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:
    1. #If iCompany = 1 Then
    2.     'Blah, blah, blah...
    3. #Else If iCompany = 2 Then
    4.     'Blah, blah, blah...
    5. #Else
    6.     'Blah, blah, blah...
    7. #End If
    You can declare the compilation variable in the project properties under the Make tab - Conditional Compilation Arguments:
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    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:
    VB Code:
    1. #Const Company1 = True
    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.

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    38

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width