Background: Currently an intern at a company and working on repurposing older programs (still in use, but for different departments) for use in testing new hardware. The new hardware is different in terms of register layout and firmware interface from the older iterations of hardware. I have been given free reign on how to setup this project as it is to be used for the new hardware exclusively. Currently there is a single .c file and 5 different header files that make up the program. The .c file is currently over 10000 lines long and comprises EVERY single function in use of main().My question is, should I split the code into more recognizable chunks of .c files? It is currently only a mild annoyance to go through and find the methods I need, but it is time-consuming and I do have deadlines. What are the benefits and tradeoffs of doing so now, rather than later?I aim to finish re-purposing the program by next week (this is heavy optimism, it will most likely take two weeks), so is it more efficient to start culling and moving around code now, or will I benefit more from just attempting to force my way through as is?
Starting on a large project, should I split it into more concise parts?
project management;c;refactoring;efficiency;maintainability
If it is possible make the existing code more manageable, you should better refactor it. Otherwise it's going to cause you trouble every time you refer to it. Imagine that you need to work with that code again in a year or two. I don't think it will be a pleasant experience. Even if you don't have much time, it is really worth refactoring. I think one day will be more than enough for splitting the code into several logical pieces and creating a separate file for each. This will help you get the bigger picture of the code as a whole, and next time you need to find something you will know exactly where to look.There are some similar (but not duplicate) questions. Take a look at them:Refactoring while programmingHow should I start refactoring my mostly-procedural C++ application?When to refactor