4

Should I modify the file? or Copy the file?
it is already in use for a similar case but different.

double code vs doing one thing per class
a large refactor is needed for this one.

#codestruggles

Comments
  • 1
    That depends on if you believe you will face further similar choices and how much will be changed.

    I generally favor reuse, either by adding behavior to a class or by slitting it in ways that separates the differences.

    But is some cases where you either know there will be no more copies, for example if the old one is to be retired eventually or if you foresee major coming changes that will further separate the code to a point where there is so little in common its not worth it.

    Or of the platform/framework all but enforces separation.

    Or if the files end up supported by different teams.

    So, not a definitive answer but my rules of thumb.
  • 0
    @voxera
    in this case class (reader) does Reading and processing.. now I need the reader class and it needs to process something else.

    Both the processing and the interreacting with the reader class is different.

    A good solution would be to separate the reading and processing from each other. and then reuse the reading class..

    however I don't have time for that..

    and modifying the existing class would only fuck me over 5 weeks later if suddenly I need to implement another form of processing..

    this whole code base is simply adding and adding... without thinking.. and now I'm stuck doing the same thing otherwise it takes me months to rework and hoping I don't break stuff
Add Comment