Best approach to refactor code to a newer version

Tag: refactoring Author: dhlbl2008 Date: 2010-07-31

This question is related to my experience with FOSS as a student. Sorry I might be a bit subjective, but working with a certain approach here and would want to know if I am on the right track.

I am involved in project,where I am supposed to refactor code which has been already written by someone else but was never included in the main trunk. The core code stays the same but as the GUI of the project has evolved changes needed to be made before it can be integrated.

My Approach till now has been:

  1. Separate the core from GUI dependent code
  2. Copy+Paste all the core code(As it should work )

For sometime I had no problems but now for a class on which my code depends, I am facing problems as the newer version has a different constructor and has different looking code.

What is the best way out in such cases?

Understanding all the code will take time. And I am beginner working on bigger project.

Other Answer1

First of i belive your talking about merging 2 branches and not refactoring.

The way i would approarch this is:
1) Find out what the "master" bransh is.
2) Merge the other branch into this one.
3) When you find code that conflicts you need to understand what are removing or adding. If one Class/function differes, it might have added some feature or fixed a bug, so you should make take the "best" one that meets the specs of the app your building.
4) When you have merged the branches, and the major funsjonality works ( IE what the specs require) i would refactor the code.


Yeah The entire code previously written lies in a different branch. Not part of the main trunk. Do I need a merger here?
I dont have write access to the repository. I am just an observer.