deadCrow
deadCrow

Reputation: 31

Code duplication in .NET

Let's assume you have a windows form that allows you to input your name in a textbox, you press a button and pops up a message box with your name. Now, lets assume that a user come forward and want another textbox to print their surname. You determine that this feature will require months to develop (I'm exaggerating on purpose but please bear the concept).

Hence, you do not want to amend the existing form because otherwise you cannot release your product until the new feature is completed. My approach to such scenario is to make a copy and paste of the form, implement the changes, test them and when ready the old form is replaced with the latest version.

This approach has the major draw back that any quick fixes to the old form need to be replicated in the new form as well and thus resulting in duplication of effort. Apart from the fact that I hate copy-and-pasting; this just doesn't feel right.

Another approach would be to create a class that inherits the original form and hence any bug fix to the "old" form is automatically available to the new form. This approach gives you the flexibility to develop in this "new" form while allowing you for issue bug-fixes on the old.

However, I'm not convinced this is the right approach. Do you have an alternative and better approach to this scenario?

Upvotes: 0

Views: 56

Answers (1)

MicroVirus
MicroVirus

Reputation: 5477

Sounds like what you want is a version management subsystem. Look into Git, SVN or others. These allow you to work on several 'versions' of the program at once, make changes, merge those changes, etc.

As mentioned in the comments, a document on Git describing the possible workflows using branches might get you started. For Tortoise/Mercurial, this SO question might answer your question.

Upvotes: 1

Related Questions