开发者

Best approach to refactor code to a newer version

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜