In this project, I used refactored code to determine if it would save time compared to creating it from scratch. I also evaluated whether the new code would run faster when computing larger datasets. I tested and debugged the code, then organized it for easier maintenance for future users. The purpose of this project was to gain experience with refactored code, assessing if it would lead to quicker completion, cleaner results, and efficient handling of larger datasets compared to green_stocks.xlsm.
The refactored code performed efficiently compared to the original VBA scripts due to cleaner coding of the loops. The refactored code's elapsed time was roughly seven seconds faster than the original. Comparing stock performance between 2017 and 2018, stocks performed significantly better in 2017. Various factors affected stock performance overall. In 2018, several factors caused the stock market to perform unfavorably. One major factor was the trade war between the U.S. and China, which slowed economic growth and led to tariffs on imported aluminum, steel, and other goods. An increase in the Federal Reserve rate was also a factor that affected overall stock performance.
2017 Stocks Performance - Majority of the stocks performed well due to one of the few factors, corporate tax break
2018 STocks Performance - Majority of the stocks performed poorly due to one of the few factors, tariffs imposed on imported steels, metals & aluminum which constraint global economic growth.
The advantages of refactoring codes was to saves time and money. Refactored codes provides a blueprint or roadmap of codes that was already working before. If the refactored code was written properly and clean then it would be easier to update or make few changes and save time.
The disadvantages of refactored codes was the opposite of the advantages. It can be risky if the the code was from unknown programmer. It can be risky because the code may be unorganized, difficulty to understand which can take more time to debugg and cost more money in the long run.
The refactored codes provided guidance where to begin and how to structure the codes. It was also easier to understand the format to keep the new codes clean and organized.
Refactored codes can be a disadvantage depending on the student and how well they understand the concepts and logic of the VBA codes. It can be time consumming for student retracing everything from the beginning of the script to understand exactly what was happening within the script.