Hi all,
there is a large chunk of code (~ 130 lines) that is essentially duplicated in both dyna-draw-context.cpp and eraser-context.cpp, namely the function fit_and_split(). The two versions only really differ in a few lines, but they also contains a couple of #ifdef switches that are used for debugging. The problem is that these are also dependent on the file (to wit, #ifdef ERASER_VERBOSE and #ifdef DYNA_DRAW_VERBOSE). I believe it would make sense to melt these two functions together, but how can this be done while at the same time respecting the #ifdefs? Is there a kind of #or directive?
Max
P.S.: It just occurred to me that the two contexts might share other code, too (although I haven't checked). Perhaps they could even be merged to a larger extent.
On Aug 15, 2008, at 11:21 AM, Maximilian Albert wrote:
Hi all,
there is a large chunk of code (~ 130 lines) that is essentially duplicated in both dyna-draw-context.cpp and eraser-context.cpp, namely the function fit_and_split(). The two versions only really differ in a few lines, but they also contains a couple of #ifdef switches that are used for debugging. The problem is that these are also dependent on the file (to wit, #ifdef ERASER_VERBOSE and #ifdef DYNA_DRAW_VERBOSE). I believe it would make sense to melt these two functions together, but how can this be done while at the same time respecting the #ifdefs? Is there a kind of #or directive?
Max
P.S.: It just occurred to me that the two contexts might share other code, too (although I haven't checked). Perhaps they could even be merged to a larger extent.
Actually what happened is that the eraser code was copied from the dyna-draw code. Then as we go that is being refactored, with common code going into a common base class and the specific code being retuned and left different in each of the two original classes
So yes, you did spot a bit of duplication that needs refactoring. However it is an area that I'm working on incrementally, so you won't have to do direct cleanup yourself.
Thanks.
Jon A. Cruz schrieb:
Actually what happened is that the eraser code was copied from the dyna-draw code. Then as we go that is being refactored, with common code going into a common base class and the specific code being retuned and left different in each of the two original classes
So yes, you did spot a bit of duplication that needs refactoring. However it is an area that I'm working on incrementally, so you won't have to do direct cleanup yourself.
Awesome. Sorry for the hassle, and apologies if I came across a bit overzealous. I certainly didn't want to mess with someone else's work-in-progress. Just stumbled across this and thought I'd ask.
Max
On Aug 17, 2008, at 4:59 PM, Maximilian Albert wrote:
Jon A. Cruz schrieb:
Actually what happened is that the eraser code was copied from the dyna-draw code. Then as we go that is being refactored, with common code going into a common base class and the specific code being retuned and left different in each of the two original classes
So yes, you did spot a bit of duplication that needs refactoring. However it is an area that I'm working on incrementally, so you won't have to do direct cleanup yourself.
Awesome. Sorry for the hassle, and apologies if I came across a bit overzealous. I certainly didn't want to mess with someone else's work-in-progress. Just stumbled across this and thought I'd ask.
Oh, no problems at all.
For things such as this, just asking is a very good step. Sometimes the area is in the middle of updating, but then some other times it has been left and needs someone else to pick up fixing it.
Sending a quick note to check is probably the best way to know how to proceed.
participants (2)
-
Jon A. Cruz
-
Maximilian Albert