The purpose of this project is to analyize the performance of a set of stocks in the years 2017 and 2018 using a refractored code and compare it to the original code. We will be looking at the run times to determine if the refractored code is more efficient than the original one.
The biggest difference between the original code and the refractored code was the num,ber of loops used. We used two loops in the original code, one of them being nested, shown below:
In the refractored code we only used one
This means that the execution time for the refractored code was faster than the original.
One of the biggest advantages when refractoring code is how it look and how easy it is to read. Thsi is essential for debugging as it is easier to look through the code and find where some mistakes might be, as well as for others to look over it and understand what is going on. Another important advantage is that the code will run faster compared to the original code.
Some disadvanteges of refractoring code can come from not having a complete understanding on how to simplify the original code which can lead to errors in the code and the time spent thinking of different ways to simplify the code.
I would consider the difference in the way the code looks and how easily it is to read and understand one of the biggest pros. This was due to not having a nested loop which also lead to the runtime being faster.
The cons would be knowing how to simplify code in a way that looks cleaner, is faster to write and run.