Whats the best way to handle refactoring a big file? The Next CEO of Stack OverflowFile structure of object-oriented projects seems clutteredBest way to use source control for a project (1-3 people)What's the best way to undo a Git merge that wipes files out of the repo?Developers blocked by waiting on code to merge from another branch using GitFlowGit branch model critique: always derive from masterGit branching strategy for long-running unreleased codeThe trend of the “develop” branch going awayAuto-merging from master to all branches — good or bad idea?Branching a subdirectory while keeping commits from other directoriesIs it good practice to switch back to an old branch to develop a new feature or to create a new branch?What are the “gotchas” of refactoring code that is binary serialized?

Visit to the USA with ESTA approved before trip to Iran

'Given that' in a matrix

How can I open an app using Terminal?

Why is Miller's case titled R (Miller)?

What is the point of a new vote on May's deal when the indicative votes suggest she will not win?

What is the difference between "behavior" and "behaviour"?

Implement the Thanos sorting algorithm

Trouble understanding the speech of overseas colleagues

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

How do I go from 300 unfinished/half written blog posts, to published posts?

suction cup thing with 1/4 TRS cable?

declare as function pointer and initialize in the same line

What's the point of interval inversion?

Unreliable Magic - Is it worth it?

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

How do spells that require an ability check vs. the caster's spell save DC work?

How easy is it to start Magic from scratch?

Why didn't Khan get resurrected in the Genesis Explosion?

Is there a good way to store credentials outside of a password manager?

What is the meaning of "rider"?

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

How to make a variable always equal to the result of some calculations?

Why does standard notation not preserve intervals (visually)

Why here is plural "We went to the movies last night."



Whats the best way to handle refactoring a big file?



The Next CEO of Stack OverflowFile structure of object-oriented projects seems clutteredBest way to use source control for a project (1-3 people)What's the best way to undo a Git merge that wipes files out of the repo?Developers blocked by waiting on code to merge from another branch using GitFlowGit branch model critique: always derive from masterGit branching strategy for long-running unreleased codeThe trend of the “develop” branch going awayAuto-merging from master to all branches — good or bad idea?Branching a subdirectory while keeping commits from other directoriesIs it good practice to switch back to an old branch to develop a new feature or to create a new branch?What are the “gotchas” of refactoring code that is binary serialized?










7















Im currently working on a bigger project which unfortunately has some files where software quality guidelines where not always followed. This includes big files (read 2000-4000 lines) which clearly contain multiple distinct functionalities.



Now I want to refactor these big files into multiple small ones. The issue is, since they are so big, multiple people (me included) on different branches are working on these files. So I cant really branch from develop and refactor, since merging these refactorings with other peoples changes will become difficult.



We could of course require everyone to merge back to develop, "freeze" the files (ie. dont allow anyone to edit them anymore), refactor, and then "unfreeze". But this is not really good either, since this would require everyone to basically stop their work on these files until refactoring is done.



So is there a way to refactor, dont require anyone else to stop working (for to long) or merge back their feature branches to develop?










share|improve this question







New contributor




Hoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • stackoverflow.com/questions/1897585/…

    – Robert Andrzejuk
    4 hours ago






  • 1





    I think this also depends on the programming language used.

    – Robert Andrzejuk
    4 hours ago











  • I like "small incremental" checkins. Unless someone isn't keeping their copy of the repo fresh, this practice will minimize merge conflicts for everyone.

    – Matt Raffel
    1 hour ago















7















Im currently working on a bigger project which unfortunately has some files where software quality guidelines where not always followed. This includes big files (read 2000-4000 lines) which clearly contain multiple distinct functionalities.



Now I want to refactor these big files into multiple small ones. The issue is, since they are so big, multiple people (me included) on different branches are working on these files. So I cant really branch from develop and refactor, since merging these refactorings with other peoples changes will become difficult.



We could of course require everyone to merge back to develop, "freeze" the files (ie. dont allow anyone to edit them anymore), refactor, and then "unfreeze". But this is not really good either, since this would require everyone to basically stop their work on these files until refactoring is done.



So is there a way to refactor, dont require anyone else to stop working (for to long) or merge back their feature branches to develop?










share|improve this question







New contributor




Hoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • stackoverflow.com/questions/1897585/…

    – Robert Andrzejuk
    4 hours ago






  • 1





    I think this also depends on the programming language used.

    – Robert Andrzejuk
    4 hours ago











  • I like "small incremental" checkins. Unless someone isn't keeping their copy of the repo fresh, this practice will minimize merge conflicts for everyone.

    – Matt Raffel
    1 hour ago













7












7








7








Im currently working on a bigger project which unfortunately has some files where software quality guidelines where not always followed. This includes big files (read 2000-4000 lines) which clearly contain multiple distinct functionalities.



Now I want to refactor these big files into multiple small ones. The issue is, since they are so big, multiple people (me included) on different branches are working on these files. So I cant really branch from develop and refactor, since merging these refactorings with other peoples changes will become difficult.



We could of course require everyone to merge back to develop, "freeze" the files (ie. dont allow anyone to edit them anymore), refactor, and then "unfreeze". But this is not really good either, since this would require everyone to basically stop their work on these files until refactoring is done.



So is there a way to refactor, dont require anyone else to stop working (for to long) or merge back their feature branches to develop?










share|improve this question







New contributor




Hoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












Im currently working on a bigger project which unfortunately has some files where software quality guidelines where not always followed. This includes big files (read 2000-4000 lines) which clearly contain multiple distinct functionalities.



Now I want to refactor these big files into multiple small ones. The issue is, since they are so big, multiple people (me included) on different branches are working on these files. So I cant really branch from develop and refactor, since merging these refactorings with other peoples changes will become difficult.



We could of course require everyone to merge back to develop, "freeze" the files (ie. dont allow anyone to edit them anymore), refactor, and then "unfreeze". But this is not really good either, since this would require everyone to basically stop their work on these files until refactoring is done.



So is there a way to refactor, dont require anyone else to stop working (for to long) or merge back their feature branches to develop?







git refactoring code-quality






share|improve this question







New contributor




Hoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Hoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Hoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 5 hours ago









HoffHoff

412




412




New contributor




Hoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Hoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Hoff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • stackoverflow.com/questions/1897585/…

    – Robert Andrzejuk
    4 hours ago






  • 1





    I think this also depends on the programming language used.

    – Robert Andrzejuk
    4 hours ago











  • I like "small incremental" checkins. Unless someone isn't keeping their copy of the repo fresh, this practice will minimize merge conflicts for everyone.

    – Matt Raffel
    1 hour ago

















  • stackoverflow.com/questions/1897585/…

    – Robert Andrzejuk
    4 hours ago






  • 1





    I think this also depends on the programming language used.

    – Robert Andrzejuk
    4 hours ago











  • I like "small incremental" checkins. Unless someone isn't keeping their copy of the repo fresh, this practice will minimize merge conflicts for everyone.

    – Matt Raffel
    1 hour ago
















stackoverflow.com/questions/1897585/…

– Robert Andrzejuk
4 hours ago





stackoverflow.com/questions/1897585/…

– Robert Andrzejuk
4 hours ago




1




1





I think this also depends on the programming language used.

– Robert Andrzejuk
4 hours ago





I think this also depends on the programming language used.

– Robert Andrzejuk
4 hours ago













I like "small incremental" checkins. Unless someone isn't keeping their copy of the repo fresh, this practice will minimize merge conflicts for everyone.

– Matt Raffel
1 hour ago





I like "small incremental" checkins. Unless someone isn't keeping their copy of the repo fresh, this practice will minimize merge conflicts for everyone.

– Matt Raffel
1 hour ago










5 Answers
5






active

oldest

votes


















7














You have correctly understood that this is not so much a technical as a social problem: if you want to avoid excessive merge conflicts, the team needs to collaborate in a way that avoids these conflicts.



This is part of a general problem with Git, in that branching is very easy but merging can still take a lot of effort. Development teams tend to launch a lot of branches and are then surprised that merging them is difficult, possibly because they are trying to emulate the Git Flow without understanding its context.



The general rule to fast and easy merges is to prevent big differences from accumulating, in particular that feature branches should be very short lived (hours or days, not months). A development team that is able to rapidly integrate their changes will see fewer merge conflicts. If some code isn't yet production ready, it might be possible to integrate it but deactivate it through a feature flag. As soon as the code has been integrated into your master branch, it becomes accessible to the kind of refactoring you are trying to do.



That might be too much for your immediate problem. But it may be feasible to ask colleagues to merge their changes that impact this file until the end of the week so that you can perform the refactoring. If they wait longer, they'll have to deal with the merge conflicts themselves. That's not impossible, it's just avoidable work.



You may also want to prevent large swaths of dependent code by making API-compatible changes. For example, if you want to extract some functionality into a separate module:



  1. Extract the functionality into a separate module.

  2. Change the old functions to forward their calls to the new API.

  3. Over time, port dependent code to the new API.

  4. Finally, you can delete the old functions.

This multi-step process can avoid many merge conflicts. In particular, there will only be conflicts if someone else is also changing the functionality you extracted. The cost of this approach is that it's much slower than changing everything at once, and that you temporarily have two duplicate APIs. This isn't so bad until something urgent interrupts this refactoring, the duplication is forgotten or deprioritized, and you end up with a bunch of tech debt.



But in the end, any solution will require you to coordinate with your team.






share|improve this answer























  • So, if I got It right, the advice is smaller developments, frequent commits (push) and daily (to say something) merges. Right? In other words, to change the SDLC cadence

    – Laiv
    4 hours ago












  • @Laiv Unfortunately that is all extremely general advice, but some ideas out of the agile-ish space like Continuous Integration clearly have their merits. Teams that work together (and integrate their work frequently) will have an easier time making large cross-cutting changes than teams that only work alongside each other. This isn't necessarily about the SDLC at large, more about the collaboration within the team. Some approaches make working alongside more feasible (think Open/Closed Principle, microservices) but OP's team isn't there yet.

    – amon
    4 hours ago











  • If it's about collaboration. Would it be possible to get involved the team in the refactor? Seems to me that right now it's only one-dev's job. Multiple files of +4K LOC sounds like too much refactor for a single person to do. Or too much responsibility

    – Laiv
    4 hours ago







  • 3





    I wouldn't go so far as to say a feature branch needs to have a short lifetime -- merely that it should not diverge from its parent branch for long periods of time. Regularly merging changes from the parent branch into the feature branch works in those cases where the feature branch needs to stick around longer. Still, it's a good idea to keep feature branches around no longer than necessary.

    – Dan Lyons
    3 hours ago











  • @Laiv In my experience, it makes sense to discuss a post-refactoring design with the team beforehand, but it's usually easiest if a single person makes the changes to the code. Otherwise, you're back to the problem that you have to merge stuff. The 4k lines sounds like a lot, but it's really not for targeted refactorings like extract-class. (I'd shill Martin Fowler's Refactoring book so hard here if I had read it.) But 4k lines is a lot only for untargeted refactorings like “let's see how I can improve this”.

    – amon
    1 hour ago


















7














Do the refactoring in smaller steps. Lets say your large file has the name Foo:



  1. Add a new empty file Bar - commit it to "trunk".


  2. Find a small portion of the code in Foo which can be moved over to Bar. Apply the move, update from trunk, build and test the code, and commit to "trunk".


  3. Repeat step 2 until Foo and Bar have equal size (or whatever size you prefer)


That way, next time your team mates update their branches from trunk, they get your changes in "small portions" and can merge them one-by-one, which is a lot easier than having to merge a full split in one step. Same holds when in step 2 you get a merge conflict because someone else in between updated trunk.



This won't eliminate merge conflicts, but it restricts each conflict to a small area of code, which is way more manageable.



And of course - communicate the refactoring in the team. Inform your mates what you are doing, so they know why they have to expect merge conflicts for the particular file.






share|improve this answer
































    6














    You are thinking of splitting the file as an atomic operation, but there are intermediate changes you can make. The file gradually became huge over time, it can gradually become small over time.



    Pick a part that hasn't had to change in a long time (git blame can help with this), and split that off first. Get that change merged into everyone's branches, then pick the next easiest part to split. Maybe even splitting one part is too big a step and you should just do some rearranging within the large file first.



    If people aren't frequently merging back to develop, you should encourage that, then after they merge, take that opportunity to split off the parts they just changed. Or ask them to do the splitting off as part of the pull request review.



    The idea is to slowly move toward your goal. It will feel like progress is slow, but then suddenly you'll realize your code is a lot better. It takes a long time to turn an ocean liner.






    share|improve this answer






























      0














      Wait until hometime. Split the file, commit and merge to master.



      Other people will have to pull the changes into their feature branches in the morning like any other change.






      share|improve this answer


















      • 1





        Still would mean they would have to merge my refactorings with their changes though...

        – Hoff
        5 hours ago











      • somewhat related: suggestion about uncluttering file structure

        – Nick Alexeev
        4 hours ago












      • they are going to have to merge that big file with one another anyway. merging with your split version might actually reduce the total pain

        – Ewan
        4 hours ago











      • Well, they actually have to deal with merges anyways if they all are changing these files.

        – Laiv
        4 hours ago



















      0














      Fixing this problem requires buy-in from the other teams because you're trying to change a shared resource (the code itself). That being said, I think there's a way to "migrate away" from having huge monolithic files without disrupting people.



      I would also recommend not targeting all the huge files at once unless the number of huge files is growing uncontrollably in addition to the sizes of individual files.



      Refactoring large files like this frequently causes unexpected problems. The first step is to stop the big files from accumulating additional functionality beyond what's currently in master or in development branches.



      I think the best way to do this is with commit hooks that block certain additions to the large files by default, but can be overruled with a magical comment in the commit message, like @bigfileok or something. It's important to be able to overrule the policy in a way that's painless but trackable. Ideally, you should be able to run the commit hook locally and it should tell you how to override this particular error in the error message itself.



      The commit hook could check for new classes or do other static analysis (ad hoc or not). You can also just pick a line or character count that's 10% larger than the file currently is and say that the large file can't grow beyond the new limit. You can also reject individual commits that grow the new file by too many lines or too many characters or w/e.



      Once the large file stops accumulating new functionality, you can refactor things out of it one at a time (and reduce the tresholds enforced by the commit hooks at the same time to prevent it from growing again).



      Eventually, the large files will be small enough that the commit hooks can be completely removed.






      share|improve this answer























        Your Answer








        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "131"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );






        Hoff is a new contributor. Be nice, and check out our Code of Conduct.









        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsoftwareengineering.stackexchange.com%2fquestions%2f389380%2fwhats-the-best-way-to-handle-refactoring-a-big-file%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        7














        You have correctly understood that this is not so much a technical as a social problem: if you want to avoid excessive merge conflicts, the team needs to collaborate in a way that avoids these conflicts.



        This is part of a general problem with Git, in that branching is very easy but merging can still take a lot of effort. Development teams tend to launch a lot of branches and are then surprised that merging them is difficult, possibly because they are trying to emulate the Git Flow without understanding its context.



        The general rule to fast and easy merges is to prevent big differences from accumulating, in particular that feature branches should be very short lived (hours or days, not months). A development team that is able to rapidly integrate their changes will see fewer merge conflicts. If some code isn't yet production ready, it might be possible to integrate it but deactivate it through a feature flag. As soon as the code has been integrated into your master branch, it becomes accessible to the kind of refactoring you are trying to do.



        That might be too much for your immediate problem. But it may be feasible to ask colleagues to merge their changes that impact this file until the end of the week so that you can perform the refactoring. If they wait longer, they'll have to deal with the merge conflicts themselves. That's not impossible, it's just avoidable work.



        You may also want to prevent large swaths of dependent code by making API-compatible changes. For example, if you want to extract some functionality into a separate module:



        1. Extract the functionality into a separate module.

        2. Change the old functions to forward their calls to the new API.

        3. Over time, port dependent code to the new API.

        4. Finally, you can delete the old functions.

        This multi-step process can avoid many merge conflicts. In particular, there will only be conflicts if someone else is also changing the functionality you extracted. The cost of this approach is that it's much slower than changing everything at once, and that you temporarily have two duplicate APIs. This isn't so bad until something urgent interrupts this refactoring, the duplication is forgotten or deprioritized, and you end up with a bunch of tech debt.



        But in the end, any solution will require you to coordinate with your team.






        share|improve this answer























        • So, if I got It right, the advice is smaller developments, frequent commits (push) and daily (to say something) merges. Right? In other words, to change the SDLC cadence

          – Laiv
          4 hours ago












        • @Laiv Unfortunately that is all extremely general advice, but some ideas out of the agile-ish space like Continuous Integration clearly have their merits. Teams that work together (and integrate their work frequently) will have an easier time making large cross-cutting changes than teams that only work alongside each other. This isn't necessarily about the SDLC at large, more about the collaboration within the team. Some approaches make working alongside more feasible (think Open/Closed Principle, microservices) but OP's team isn't there yet.

          – amon
          4 hours ago











        • If it's about collaboration. Would it be possible to get involved the team in the refactor? Seems to me that right now it's only one-dev's job. Multiple files of +4K LOC sounds like too much refactor for a single person to do. Or too much responsibility

          – Laiv
          4 hours ago







        • 3





          I wouldn't go so far as to say a feature branch needs to have a short lifetime -- merely that it should not diverge from its parent branch for long periods of time. Regularly merging changes from the parent branch into the feature branch works in those cases where the feature branch needs to stick around longer. Still, it's a good idea to keep feature branches around no longer than necessary.

          – Dan Lyons
          3 hours ago











        • @Laiv In my experience, it makes sense to discuss a post-refactoring design with the team beforehand, but it's usually easiest if a single person makes the changes to the code. Otherwise, you're back to the problem that you have to merge stuff. The 4k lines sounds like a lot, but it's really not for targeted refactorings like extract-class. (I'd shill Martin Fowler's Refactoring book so hard here if I had read it.) But 4k lines is a lot only for untargeted refactorings like “let's see how I can improve this”.

          – amon
          1 hour ago















        7














        You have correctly understood that this is not so much a technical as a social problem: if you want to avoid excessive merge conflicts, the team needs to collaborate in a way that avoids these conflicts.



        This is part of a general problem with Git, in that branching is very easy but merging can still take a lot of effort. Development teams tend to launch a lot of branches and are then surprised that merging them is difficult, possibly because they are trying to emulate the Git Flow without understanding its context.



        The general rule to fast and easy merges is to prevent big differences from accumulating, in particular that feature branches should be very short lived (hours or days, not months). A development team that is able to rapidly integrate their changes will see fewer merge conflicts. If some code isn't yet production ready, it might be possible to integrate it but deactivate it through a feature flag. As soon as the code has been integrated into your master branch, it becomes accessible to the kind of refactoring you are trying to do.



        That might be too much for your immediate problem. But it may be feasible to ask colleagues to merge their changes that impact this file until the end of the week so that you can perform the refactoring. If they wait longer, they'll have to deal with the merge conflicts themselves. That's not impossible, it's just avoidable work.



        You may also want to prevent large swaths of dependent code by making API-compatible changes. For example, if you want to extract some functionality into a separate module:



        1. Extract the functionality into a separate module.

        2. Change the old functions to forward their calls to the new API.

        3. Over time, port dependent code to the new API.

        4. Finally, you can delete the old functions.

        This multi-step process can avoid many merge conflicts. In particular, there will only be conflicts if someone else is also changing the functionality you extracted. The cost of this approach is that it's much slower than changing everything at once, and that you temporarily have two duplicate APIs. This isn't so bad until something urgent interrupts this refactoring, the duplication is forgotten or deprioritized, and you end up with a bunch of tech debt.



        But in the end, any solution will require you to coordinate with your team.






        share|improve this answer























        • So, if I got It right, the advice is smaller developments, frequent commits (push) and daily (to say something) merges. Right? In other words, to change the SDLC cadence

          – Laiv
          4 hours ago












        • @Laiv Unfortunately that is all extremely general advice, but some ideas out of the agile-ish space like Continuous Integration clearly have their merits. Teams that work together (and integrate their work frequently) will have an easier time making large cross-cutting changes than teams that only work alongside each other. This isn't necessarily about the SDLC at large, more about the collaboration within the team. Some approaches make working alongside more feasible (think Open/Closed Principle, microservices) but OP's team isn't there yet.

          – amon
          4 hours ago











        • If it's about collaboration. Would it be possible to get involved the team in the refactor? Seems to me that right now it's only one-dev's job. Multiple files of +4K LOC sounds like too much refactor for a single person to do. Or too much responsibility

          – Laiv
          4 hours ago







        • 3





          I wouldn't go so far as to say a feature branch needs to have a short lifetime -- merely that it should not diverge from its parent branch for long periods of time. Regularly merging changes from the parent branch into the feature branch works in those cases where the feature branch needs to stick around longer. Still, it's a good idea to keep feature branches around no longer than necessary.

          – Dan Lyons
          3 hours ago











        • @Laiv In my experience, it makes sense to discuss a post-refactoring design with the team beforehand, but it's usually easiest if a single person makes the changes to the code. Otherwise, you're back to the problem that you have to merge stuff. The 4k lines sounds like a lot, but it's really not for targeted refactorings like extract-class. (I'd shill Martin Fowler's Refactoring book so hard here if I had read it.) But 4k lines is a lot only for untargeted refactorings like “let's see how I can improve this”.

          – amon
          1 hour ago













        7












        7








        7







        You have correctly understood that this is not so much a technical as a social problem: if you want to avoid excessive merge conflicts, the team needs to collaborate in a way that avoids these conflicts.



        This is part of a general problem with Git, in that branching is very easy but merging can still take a lot of effort. Development teams tend to launch a lot of branches and are then surprised that merging them is difficult, possibly because they are trying to emulate the Git Flow without understanding its context.



        The general rule to fast and easy merges is to prevent big differences from accumulating, in particular that feature branches should be very short lived (hours or days, not months). A development team that is able to rapidly integrate their changes will see fewer merge conflicts. If some code isn't yet production ready, it might be possible to integrate it but deactivate it through a feature flag. As soon as the code has been integrated into your master branch, it becomes accessible to the kind of refactoring you are trying to do.



        That might be too much for your immediate problem. But it may be feasible to ask colleagues to merge their changes that impact this file until the end of the week so that you can perform the refactoring. If they wait longer, they'll have to deal with the merge conflicts themselves. That's not impossible, it's just avoidable work.



        You may also want to prevent large swaths of dependent code by making API-compatible changes. For example, if you want to extract some functionality into a separate module:



        1. Extract the functionality into a separate module.

        2. Change the old functions to forward their calls to the new API.

        3. Over time, port dependent code to the new API.

        4. Finally, you can delete the old functions.

        This multi-step process can avoid many merge conflicts. In particular, there will only be conflicts if someone else is also changing the functionality you extracted. The cost of this approach is that it's much slower than changing everything at once, and that you temporarily have two duplicate APIs. This isn't so bad until something urgent interrupts this refactoring, the duplication is forgotten or deprioritized, and you end up with a bunch of tech debt.



        But in the end, any solution will require you to coordinate with your team.






        share|improve this answer













        You have correctly understood that this is not so much a technical as a social problem: if you want to avoid excessive merge conflicts, the team needs to collaborate in a way that avoids these conflicts.



        This is part of a general problem with Git, in that branching is very easy but merging can still take a lot of effort. Development teams tend to launch a lot of branches and are then surprised that merging them is difficult, possibly because they are trying to emulate the Git Flow without understanding its context.



        The general rule to fast and easy merges is to prevent big differences from accumulating, in particular that feature branches should be very short lived (hours or days, not months). A development team that is able to rapidly integrate their changes will see fewer merge conflicts. If some code isn't yet production ready, it might be possible to integrate it but deactivate it through a feature flag. As soon as the code has been integrated into your master branch, it becomes accessible to the kind of refactoring you are trying to do.



        That might be too much for your immediate problem. But it may be feasible to ask colleagues to merge their changes that impact this file until the end of the week so that you can perform the refactoring. If they wait longer, they'll have to deal with the merge conflicts themselves. That's not impossible, it's just avoidable work.



        You may also want to prevent large swaths of dependent code by making API-compatible changes. For example, if you want to extract some functionality into a separate module:



        1. Extract the functionality into a separate module.

        2. Change the old functions to forward their calls to the new API.

        3. Over time, port dependent code to the new API.

        4. Finally, you can delete the old functions.

        This multi-step process can avoid many merge conflicts. In particular, there will only be conflicts if someone else is also changing the functionality you extracted. The cost of this approach is that it's much slower than changing everything at once, and that you temporarily have two duplicate APIs. This isn't so bad until something urgent interrupts this refactoring, the duplication is forgotten or deprioritized, and you end up with a bunch of tech debt.



        But in the end, any solution will require you to coordinate with your team.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 4 hours ago









        amonamon

        89.4k21170260




        89.4k21170260












        • So, if I got It right, the advice is smaller developments, frequent commits (push) and daily (to say something) merges. Right? In other words, to change the SDLC cadence

          – Laiv
          4 hours ago












        • @Laiv Unfortunately that is all extremely general advice, but some ideas out of the agile-ish space like Continuous Integration clearly have their merits. Teams that work together (and integrate their work frequently) will have an easier time making large cross-cutting changes than teams that only work alongside each other. This isn't necessarily about the SDLC at large, more about the collaboration within the team. Some approaches make working alongside more feasible (think Open/Closed Principle, microservices) but OP's team isn't there yet.

          – amon
          4 hours ago











        • If it's about collaboration. Would it be possible to get involved the team in the refactor? Seems to me that right now it's only one-dev's job. Multiple files of +4K LOC sounds like too much refactor for a single person to do. Or too much responsibility

          – Laiv
          4 hours ago







        • 3





          I wouldn't go so far as to say a feature branch needs to have a short lifetime -- merely that it should not diverge from its parent branch for long periods of time. Regularly merging changes from the parent branch into the feature branch works in those cases where the feature branch needs to stick around longer. Still, it's a good idea to keep feature branches around no longer than necessary.

          – Dan Lyons
          3 hours ago











        • @Laiv In my experience, it makes sense to discuss a post-refactoring design with the team beforehand, but it's usually easiest if a single person makes the changes to the code. Otherwise, you're back to the problem that you have to merge stuff. The 4k lines sounds like a lot, but it's really not for targeted refactorings like extract-class. (I'd shill Martin Fowler's Refactoring book so hard here if I had read it.) But 4k lines is a lot only for untargeted refactorings like “let's see how I can improve this”.

          – amon
          1 hour ago

















        • So, if I got It right, the advice is smaller developments, frequent commits (push) and daily (to say something) merges. Right? In other words, to change the SDLC cadence

          – Laiv
          4 hours ago












        • @Laiv Unfortunately that is all extremely general advice, but some ideas out of the agile-ish space like Continuous Integration clearly have their merits. Teams that work together (and integrate their work frequently) will have an easier time making large cross-cutting changes than teams that only work alongside each other. This isn't necessarily about the SDLC at large, more about the collaboration within the team. Some approaches make working alongside more feasible (think Open/Closed Principle, microservices) but OP's team isn't there yet.

          – amon
          4 hours ago











        • If it's about collaboration. Would it be possible to get involved the team in the refactor? Seems to me that right now it's only one-dev's job. Multiple files of +4K LOC sounds like too much refactor for a single person to do. Or too much responsibility

          – Laiv
          4 hours ago







        • 3





          I wouldn't go so far as to say a feature branch needs to have a short lifetime -- merely that it should not diverge from its parent branch for long periods of time. Regularly merging changes from the parent branch into the feature branch works in those cases where the feature branch needs to stick around longer. Still, it's a good idea to keep feature branches around no longer than necessary.

          – Dan Lyons
          3 hours ago











        • @Laiv In my experience, it makes sense to discuss a post-refactoring design with the team beforehand, but it's usually easiest if a single person makes the changes to the code. Otherwise, you're back to the problem that you have to merge stuff. The 4k lines sounds like a lot, but it's really not for targeted refactorings like extract-class. (I'd shill Martin Fowler's Refactoring book so hard here if I had read it.) But 4k lines is a lot only for untargeted refactorings like “let's see how I can improve this”.

          – amon
          1 hour ago
















        So, if I got It right, the advice is smaller developments, frequent commits (push) and daily (to say something) merges. Right? In other words, to change the SDLC cadence

        – Laiv
        4 hours ago






        So, if I got It right, the advice is smaller developments, frequent commits (push) and daily (to say something) merges. Right? In other words, to change the SDLC cadence

        – Laiv
        4 hours ago














        @Laiv Unfortunately that is all extremely general advice, but some ideas out of the agile-ish space like Continuous Integration clearly have their merits. Teams that work together (and integrate their work frequently) will have an easier time making large cross-cutting changes than teams that only work alongside each other. This isn't necessarily about the SDLC at large, more about the collaboration within the team. Some approaches make working alongside more feasible (think Open/Closed Principle, microservices) but OP's team isn't there yet.

        – amon
        4 hours ago





        @Laiv Unfortunately that is all extremely general advice, but some ideas out of the agile-ish space like Continuous Integration clearly have their merits. Teams that work together (and integrate their work frequently) will have an easier time making large cross-cutting changes than teams that only work alongside each other. This isn't necessarily about the SDLC at large, more about the collaboration within the team. Some approaches make working alongside more feasible (think Open/Closed Principle, microservices) but OP's team isn't there yet.

        – amon
        4 hours ago













        If it's about collaboration. Would it be possible to get involved the team in the refactor? Seems to me that right now it's only one-dev's job. Multiple files of +4K LOC sounds like too much refactor for a single person to do. Or too much responsibility

        – Laiv
        4 hours ago






        If it's about collaboration. Would it be possible to get involved the team in the refactor? Seems to me that right now it's only one-dev's job. Multiple files of +4K LOC sounds like too much refactor for a single person to do. Or too much responsibility

        – Laiv
        4 hours ago





        3




        3





        I wouldn't go so far as to say a feature branch needs to have a short lifetime -- merely that it should not diverge from its parent branch for long periods of time. Regularly merging changes from the parent branch into the feature branch works in those cases where the feature branch needs to stick around longer. Still, it's a good idea to keep feature branches around no longer than necessary.

        – Dan Lyons
        3 hours ago





        I wouldn't go so far as to say a feature branch needs to have a short lifetime -- merely that it should not diverge from its parent branch for long periods of time. Regularly merging changes from the parent branch into the feature branch works in those cases where the feature branch needs to stick around longer. Still, it's a good idea to keep feature branches around no longer than necessary.

        – Dan Lyons
        3 hours ago













        @Laiv In my experience, it makes sense to discuss a post-refactoring design with the team beforehand, but it's usually easiest if a single person makes the changes to the code. Otherwise, you're back to the problem that you have to merge stuff. The 4k lines sounds like a lot, but it's really not for targeted refactorings like extract-class. (I'd shill Martin Fowler's Refactoring book so hard here if I had read it.) But 4k lines is a lot only for untargeted refactorings like “let's see how I can improve this”.

        – amon
        1 hour ago





        @Laiv In my experience, it makes sense to discuss a post-refactoring design with the team beforehand, but it's usually easiest if a single person makes the changes to the code. Otherwise, you're back to the problem that you have to merge stuff. The 4k lines sounds like a lot, but it's really not for targeted refactorings like extract-class. (I'd shill Martin Fowler's Refactoring book so hard here if I had read it.) But 4k lines is a lot only for untargeted refactorings like “let's see how I can improve this”.

        – amon
        1 hour ago













        7














        Do the refactoring in smaller steps. Lets say your large file has the name Foo:



        1. Add a new empty file Bar - commit it to "trunk".


        2. Find a small portion of the code in Foo which can be moved over to Bar. Apply the move, update from trunk, build and test the code, and commit to "trunk".


        3. Repeat step 2 until Foo and Bar have equal size (or whatever size you prefer)


        That way, next time your team mates update their branches from trunk, they get your changes in "small portions" and can merge them one-by-one, which is a lot easier than having to merge a full split in one step. Same holds when in step 2 you get a merge conflict because someone else in between updated trunk.



        This won't eliminate merge conflicts, but it restricts each conflict to a small area of code, which is way more manageable.



        And of course - communicate the refactoring in the team. Inform your mates what you are doing, so they know why they have to expect merge conflicts for the particular file.






        share|improve this answer





























          7














          Do the refactoring in smaller steps. Lets say your large file has the name Foo:



          1. Add a new empty file Bar - commit it to "trunk".


          2. Find a small portion of the code in Foo which can be moved over to Bar. Apply the move, update from trunk, build and test the code, and commit to "trunk".


          3. Repeat step 2 until Foo and Bar have equal size (or whatever size you prefer)


          That way, next time your team mates update their branches from trunk, they get your changes in "small portions" and can merge them one-by-one, which is a lot easier than having to merge a full split in one step. Same holds when in step 2 you get a merge conflict because someone else in between updated trunk.



          This won't eliminate merge conflicts, but it restricts each conflict to a small area of code, which is way more manageable.



          And of course - communicate the refactoring in the team. Inform your mates what you are doing, so they know why they have to expect merge conflicts for the particular file.






          share|improve this answer



























            7












            7








            7







            Do the refactoring in smaller steps. Lets say your large file has the name Foo:



            1. Add a new empty file Bar - commit it to "trunk".


            2. Find a small portion of the code in Foo which can be moved over to Bar. Apply the move, update from trunk, build and test the code, and commit to "trunk".


            3. Repeat step 2 until Foo and Bar have equal size (or whatever size you prefer)


            That way, next time your team mates update their branches from trunk, they get your changes in "small portions" and can merge them one-by-one, which is a lot easier than having to merge a full split in one step. Same holds when in step 2 you get a merge conflict because someone else in between updated trunk.



            This won't eliminate merge conflicts, but it restricts each conflict to a small area of code, which is way more manageable.



            And of course - communicate the refactoring in the team. Inform your mates what you are doing, so they know why they have to expect merge conflicts for the particular file.






            share|improve this answer















            Do the refactoring in smaller steps. Lets say your large file has the name Foo:



            1. Add a new empty file Bar - commit it to "trunk".


            2. Find a small portion of the code in Foo which can be moved over to Bar. Apply the move, update from trunk, build and test the code, and commit to "trunk".


            3. Repeat step 2 until Foo and Bar have equal size (or whatever size you prefer)


            That way, next time your team mates update their branches from trunk, they get your changes in "small portions" and can merge them one-by-one, which is a lot easier than having to merge a full split in one step. Same holds when in step 2 you get a merge conflict because someone else in between updated trunk.



            This won't eliminate merge conflicts, but it restricts each conflict to a small area of code, which is way more manageable.



            And of course - communicate the refactoring in the team. Inform your mates what you are doing, so they know why they have to expect merge conflicts for the particular file.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 2 hours ago

























            answered 3 hours ago









            Doc BrownDoc Brown

            136k23251403




            136k23251403





















                6














                You are thinking of splitting the file as an atomic operation, but there are intermediate changes you can make. The file gradually became huge over time, it can gradually become small over time.



                Pick a part that hasn't had to change in a long time (git blame can help with this), and split that off first. Get that change merged into everyone's branches, then pick the next easiest part to split. Maybe even splitting one part is too big a step and you should just do some rearranging within the large file first.



                If people aren't frequently merging back to develop, you should encourage that, then after they merge, take that opportunity to split off the parts they just changed. Or ask them to do the splitting off as part of the pull request review.



                The idea is to slowly move toward your goal. It will feel like progress is slow, but then suddenly you'll realize your code is a lot better. It takes a long time to turn an ocean liner.






                share|improve this answer



























                  6














                  You are thinking of splitting the file as an atomic operation, but there are intermediate changes you can make. The file gradually became huge over time, it can gradually become small over time.



                  Pick a part that hasn't had to change in a long time (git blame can help with this), and split that off first. Get that change merged into everyone's branches, then pick the next easiest part to split. Maybe even splitting one part is too big a step and you should just do some rearranging within the large file first.



                  If people aren't frequently merging back to develop, you should encourage that, then after they merge, take that opportunity to split off the parts they just changed. Or ask them to do the splitting off as part of the pull request review.



                  The idea is to slowly move toward your goal. It will feel like progress is slow, but then suddenly you'll realize your code is a lot better. It takes a long time to turn an ocean liner.






                  share|improve this answer

























                    6












                    6








                    6







                    You are thinking of splitting the file as an atomic operation, but there are intermediate changes you can make. The file gradually became huge over time, it can gradually become small over time.



                    Pick a part that hasn't had to change in a long time (git blame can help with this), and split that off first. Get that change merged into everyone's branches, then pick the next easiest part to split. Maybe even splitting one part is too big a step and you should just do some rearranging within the large file first.



                    If people aren't frequently merging back to develop, you should encourage that, then after they merge, take that opportunity to split off the parts they just changed. Or ask them to do the splitting off as part of the pull request review.



                    The idea is to slowly move toward your goal. It will feel like progress is slow, but then suddenly you'll realize your code is a lot better. It takes a long time to turn an ocean liner.






                    share|improve this answer













                    You are thinking of splitting the file as an atomic operation, but there are intermediate changes you can make. The file gradually became huge over time, it can gradually become small over time.



                    Pick a part that hasn't had to change in a long time (git blame can help with this), and split that off first. Get that change merged into everyone's branches, then pick the next easiest part to split. Maybe even splitting one part is too big a step and you should just do some rearranging within the large file first.



                    If people aren't frequently merging back to develop, you should encourage that, then after they merge, take that opportunity to split off the parts they just changed. Or ask them to do the splitting off as part of the pull request review.



                    The idea is to slowly move toward your goal. It will feel like progress is slow, but then suddenly you'll realize your code is a lot better. It takes a long time to turn an ocean liner.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 3 hours ago









                    Karl BielefeldtKarl Bielefeldt

                    121k32215413




                    121k32215413





















                        0














                        Wait until hometime. Split the file, commit and merge to master.



                        Other people will have to pull the changes into their feature branches in the morning like any other change.






                        share|improve this answer


















                        • 1





                          Still would mean they would have to merge my refactorings with their changes though...

                          – Hoff
                          5 hours ago











                        • somewhat related: suggestion about uncluttering file structure

                          – Nick Alexeev
                          4 hours ago












                        • they are going to have to merge that big file with one another anyway. merging with your split version might actually reduce the total pain

                          – Ewan
                          4 hours ago











                        • Well, they actually have to deal with merges anyways if they all are changing these files.

                          – Laiv
                          4 hours ago
















                        0














                        Wait until hometime. Split the file, commit and merge to master.



                        Other people will have to pull the changes into their feature branches in the morning like any other change.






                        share|improve this answer


















                        • 1





                          Still would mean they would have to merge my refactorings with their changes though...

                          – Hoff
                          5 hours ago











                        • somewhat related: suggestion about uncluttering file structure

                          – Nick Alexeev
                          4 hours ago












                        • they are going to have to merge that big file with one another anyway. merging with your split version might actually reduce the total pain

                          – Ewan
                          4 hours ago











                        • Well, they actually have to deal with merges anyways if they all are changing these files.

                          – Laiv
                          4 hours ago














                        0












                        0








                        0







                        Wait until hometime. Split the file, commit and merge to master.



                        Other people will have to pull the changes into their feature branches in the morning like any other change.






                        share|improve this answer













                        Wait until hometime. Split the file, commit and merge to master.



                        Other people will have to pull the changes into their feature branches in the morning like any other change.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered 5 hours ago









                        EwanEwan

                        42.6k33594




                        42.6k33594







                        • 1





                          Still would mean they would have to merge my refactorings with their changes though...

                          – Hoff
                          5 hours ago











                        • somewhat related: suggestion about uncluttering file structure

                          – Nick Alexeev
                          4 hours ago












                        • they are going to have to merge that big file with one another anyway. merging with your split version might actually reduce the total pain

                          – Ewan
                          4 hours ago











                        • Well, they actually have to deal with merges anyways if they all are changing these files.

                          – Laiv
                          4 hours ago













                        • 1





                          Still would mean they would have to merge my refactorings with their changes though...

                          – Hoff
                          5 hours ago











                        • somewhat related: suggestion about uncluttering file structure

                          – Nick Alexeev
                          4 hours ago












                        • they are going to have to merge that big file with one another anyway. merging with your split version might actually reduce the total pain

                          – Ewan
                          4 hours ago











                        • Well, they actually have to deal with merges anyways if they all are changing these files.

                          – Laiv
                          4 hours ago








                        1




                        1





                        Still would mean they would have to merge my refactorings with their changes though...

                        – Hoff
                        5 hours ago





                        Still would mean they would have to merge my refactorings with their changes though...

                        – Hoff
                        5 hours ago













                        somewhat related: suggestion about uncluttering file structure

                        – Nick Alexeev
                        4 hours ago






                        somewhat related: suggestion about uncluttering file structure

                        – Nick Alexeev
                        4 hours ago














                        they are going to have to merge that big file with one another anyway. merging with your split version might actually reduce the total pain

                        – Ewan
                        4 hours ago





                        they are going to have to merge that big file with one another anyway. merging with your split version might actually reduce the total pain

                        – Ewan
                        4 hours ago













                        Well, they actually have to deal with merges anyways if they all are changing these files.

                        – Laiv
                        4 hours ago






                        Well, they actually have to deal with merges anyways if they all are changing these files.

                        – Laiv
                        4 hours ago












                        0














                        Fixing this problem requires buy-in from the other teams because you're trying to change a shared resource (the code itself). That being said, I think there's a way to "migrate away" from having huge monolithic files without disrupting people.



                        I would also recommend not targeting all the huge files at once unless the number of huge files is growing uncontrollably in addition to the sizes of individual files.



                        Refactoring large files like this frequently causes unexpected problems. The first step is to stop the big files from accumulating additional functionality beyond what's currently in master or in development branches.



                        I think the best way to do this is with commit hooks that block certain additions to the large files by default, but can be overruled with a magical comment in the commit message, like @bigfileok or something. It's important to be able to overrule the policy in a way that's painless but trackable. Ideally, you should be able to run the commit hook locally and it should tell you how to override this particular error in the error message itself.



                        The commit hook could check for new classes or do other static analysis (ad hoc or not). You can also just pick a line or character count that's 10% larger than the file currently is and say that the large file can't grow beyond the new limit. You can also reject individual commits that grow the new file by too many lines or too many characters or w/e.



                        Once the large file stops accumulating new functionality, you can refactor things out of it one at a time (and reduce the tresholds enforced by the commit hooks at the same time to prevent it from growing again).



                        Eventually, the large files will be small enough that the commit hooks can be completely removed.






                        share|improve this answer



























                          0














                          Fixing this problem requires buy-in from the other teams because you're trying to change a shared resource (the code itself). That being said, I think there's a way to "migrate away" from having huge monolithic files without disrupting people.



                          I would also recommend not targeting all the huge files at once unless the number of huge files is growing uncontrollably in addition to the sizes of individual files.



                          Refactoring large files like this frequently causes unexpected problems. The first step is to stop the big files from accumulating additional functionality beyond what's currently in master or in development branches.



                          I think the best way to do this is with commit hooks that block certain additions to the large files by default, but can be overruled with a magical comment in the commit message, like @bigfileok or something. It's important to be able to overrule the policy in a way that's painless but trackable. Ideally, you should be able to run the commit hook locally and it should tell you how to override this particular error in the error message itself.



                          The commit hook could check for new classes or do other static analysis (ad hoc or not). You can also just pick a line or character count that's 10% larger than the file currently is and say that the large file can't grow beyond the new limit. You can also reject individual commits that grow the new file by too many lines or too many characters or w/e.



                          Once the large file stops accumulating new functionality, you can refactor things out of it one at a time (and reduce the tresholds enforced by the commit hooks at the same time to prevent it from growing again).



                          Eventually, the large files will be small enough that the commit hooks can be completely removed.






                          share|improve this answer

























                            0












                            0








                            0







                            Fixing this problem requires buy-in from the other teams because you're trying to change a shared resource (the code itself). That being said, I think there's a way to "migrate away" from having huge monolithic files without disrupting people.



                            I would also recommend not targeting all the huge files at once unless the number of huge files is growing uncontrollably in addition to the sizes of individual files.



                            Refactoring large files like this frequently causes unexpected problems. The first step is to stop the big files from accumulating additional functionality beyond what's currently in master or in development branches.



                            I think the best way to do this is with commit hooks that block certain additions to the large files by default, but can be overruled with a magical comment in the commit message, like @bigfileok or something. It's important to be able to overrule the policy in a way that's painless but trackable. Ideally, you should be able to run the commit hook locally and it should tell you how to override this particular error in the error message itself.



                            The commit hook could check for new classes or do other static analysis (ad hoc or not). You can also just pick a line or character count that's 10% larger than the file currently is and say that the large file can't grow beyond the new limit. You can also reject individual commits that grow the new file by too many lines or too many characters or w/e.



                            Once the large file stops accumulating new functionality, you can refactor things out of it one at a time (and reduce the tresholds enforced by the commit hooks at the same time to prevent it from growing again).



                            Eventually, the large files will be small enough that the commit hooks can be completely removed.






                            share|improve this answer













                            Fixing this problem requires buy-in from the other teams because you're trying to change a shared resource (the code itself). That being said, I think there's a way to "migrate away" from having huge monolithic files without disrupting people.



                            I would also recommend not targeting all the huge files at once unless the number of huge files is growing uncontrollably in addition to the sizes of individual files.



                            Refactoring large files like this frequently causes unexpected problems. The first step is to stop the big files from accumulating additional functionality beyond what's currently in master or in development branches.



                            I think the best way to do this is with commit hooks that block certain additions to the large files by default, but can be overruled with a magical comment in the commit message, like @bigfileok or something. It's important to be able to overrule the policy in a way that's painless but trackable. Ideally, you should be able to run the commit hook locally and it should tell you how to override this particular error in the error message itself.



                            The commit hook could check for new classes or do other static analysis (ad hoc or not). You can also just pick a line or character count that's 10% larger than the file currently is and say that the large file can't grow beyond the new limit. You can also reject individual commits that grow the new file by too many lines or too many characters or w/e.



                            Once the large file stops accumulating new functionality, you can refactor things out of it one at a time (and reduce the tresholds enforced by the commit hooks at the same time to prevent it from growing again).



                            Eventually, the large files will be small enough that the commit hooks can be completely removed.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 1 hour ago









                            Gregory NisbetGregory Nisbet

                            1455




                            1455




















                                Hoff is a new contributor. Be nice, and check out our Code of Conduct.









                                draft saved

                                draft discarded


















                                Hoff is a new contributor. Be nice, and check out our Code of Conduct.












                                Hoff is a new contributor. Be nice, and check out our Code of Conduct.











                                Hoff is a new contributor. Be nice, and check out our Code of Conduct.














                                Thanks for contributing an answer to Software Engineering Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsoftwareengineering.stackexchange.com%2fquestions%2f389380%2fwhats-the-best-way-to-handle-refactoring-a-big-file%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Благоевград Съдържание География | История | Население | Политика | Икономика и инфрастуктура | Здравеопазване | Образование и наука | Култура и забавления | Забележителности | Личности | Литература | Външни препратки | Бележки | Навигация42°01′18.99″ с. ш. 23°05′51″ и. д. / 42.021944° с. ш. 23.0975° и. д.*БлагоевградразширитередактиранеОфициален уебсайт на община БлагоевградНовинарски портал на Благоевград – blagoevgrad.euСайтове за БлагоевградНационален статистически институтdariknews.bgГригоровичъ, Викторъ. „Очеркъ путешествія по Европейской Турціи“. Москва, 1877.Стрезов, Георги. Два санджака от Източна Македония. Периодично списание на Българското книжовно дружество в Средец, кн. XXXVII и XXXVIII, 1891, стр. 18 – 19.Македония. Етнография и статистикаГаджанов, Димитър Г. Мюсюлманското население в Новоосвободените земи, в: Научна експедиция в Македония и Поморавието 1916, Военноиздателски комплекс „Св. Георги Победоносец“, Университетско издателство „Св. Климент Охридски“, София, 1993, стр. 244.паметник на незнайния четник&cd=18&hl=en&ct=clnk&client=firefox-a „История на днешен Благоевград“, взето от www.museumblg.com на 16 март 2010 г.„Справка за населението на град Благоевград, община Благоевград, област Благоевград, НСИ“„The population of all towns and villages in Blagoevgrad Province with 50 inhabitants or more according to census results and latest official estimates“„Ethnic composition, all places: 2011 census“История на Неврокопска епархия.Национален статистически институтМюсюлманско изповедание. Главно мюфтийствоНационален публичен регистър на храмовете в БългарияМюсюлманско изповедание. Главно мюфтийствоwww.dnes.bg Джамията в Благоевград не била паленаwww.sesc-bg.orgСписък на побратимени градовеТехническо побратимяванеГУМ грейва в цветовете на нощен Лас Вегас под името „Largo“, „МОЛ Благоевград“..., в. „Струма“grabo.bgwww.cinemaxbg.comррр4238731-067cad53a-0546-417b-a3d3-51e49b1d2232147736077147736077

                                What is the best defense strategy for Survival in Grand Theft Auto Online?What is JP used for in Grand Theft Auto Online?How do I setup a Crew HQ in Grand Theft Auto Online?How does stealth work in Grand Theft Auto Online?Is it possible to own more than 10 cars in Grand Theft Auto online?Where to find truck/trailers in Grand Theft Auto OnlineWhat are some of the best missions to do on Grand Theft Auto 5 onlineFastest Car in Grand Theft Auto V PCHow to setup a Crew vs Crew online session in Grand Theft Auto Online?Grand theft auto 5 crossplayingRestart Grand Theft Auto V Online?

                                How does Billy Russo acquire his 'Jigsaw' mask? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why does Bane wear the mask?Why does Kylo Ren wear a mask?Why did Captain America remove his mask while fighting Batroc the Leaper?How did the OA acquire her wisdom?Is Billy Breckenridge gay?How does Adrian Toomes hide his earnings from the IRS?What is the state of affairs on Nootka Sound by the end of season 1?How did Tia Dalma acquire Captain Barbossa's body?How is one “Deemed Worthy”, to acquire the Greatsword “Dawn”?How did Karen acquire the handgun?