The purpose of this project was to refactor the analysis of the data provide by Steve, which would make it more presentable and maintainable, without altering the original functions of the code.
Refactoring has allowed elements of the project to run faster and therefore increase its user efficacity. The time taken to initiate the analysis for 2017 and 2018 has been significantly reduced and the final code has been made user friendly as opposed to the original one.
In 2017, the stocks mostly generated a positive return, with DQ having the highest Return Rate. Only TERP generated a negative return.
In 2018, the situation changed and most stocks were listed as red, meaning that their Rate of Return was negative. Only ERPH and RUN had positive returns. The negative Rate of Return could be explained by headlines and events affecting a company's stocks.
Code refactoring has many advantages and disadvantages. It is quite advantageous to maintain a code clean and it becomes easy to understand, as refactoring helps to make the program run faster and identify possible bugs. It is also important in avoiding duplicate codes and it can help another viewer/developer understand the code by facilitating its readability. Lastly, refactoring organizes codes to make different parts of the features manageable and decrease its complexity.
The main disadvantage of refactoring is the time it takes to achieve it, as an estimation to complete different processes will vary according to the complexity of projects. If the one conducting the refactoring is different from the initial developer, the code could be changed, and this could alter the original project. In addition, taking too many shortcuts to refactor could prove difficult in finding an appropriate direction for the code.
The original VBA script could be described as advantageous because the steps to run the codes were organized adequately and necessary comments were provided. However, a disadvantage could be that the steps were too lengthy and following the progression of the code became difficult as the code evolved and increased in complexity.
In contrast, refactoring was useful in achieving a simplified version of the original VBA script, and making it more presentable. The refactored code did not provide as many details as the original code, and it added steps and codes that could increase the possibility of creating bugs and of loosing the direction of the project.