I know this is a demo about removing temp variables, but this is something I deal with all too often in my own code: You basically took one loop and made it two loops. You made the code easier to read and test at the expense of performance. You basically doubled the loop time. May not be such a big deal with only 2 sums and a small data set, but what happens when you are dealing with 5 or 6 sums and a larger set? Is this a worthwhile a trade, in your opinion, or am I making a fool of myself because you handle this subject in another vid?
Thank you for the comment. You are correct. In this simple example, it did cause the loop to be replicated for a total of 3 loops. It likely wouldn't be an issue, unless someone was renting hundreds of movies. However, duplicating the loop 3 times was my mistake while creating the video. I forgot about step 007 in the Refactoring101 repository and should have used Extract Method for the FrequentRenterPoints, prior to Replace Temp With Query. see: github.com/adamculp/refactoring101/blob/master/code/007-extract_method.php (No loop was needed in the new method.) What I did introduces a bug where the points were not properly calculated. :P Yes, there are better ways to handle the replicated loop, but that was beyond the refactoring example. I would advise to refactor first, then optimize as a separate step, if needed. Thanks for watching.
@@Beachcasts Let me double down by saying as a general refactoring technique, I totally agree with this notion! Move those temps into meaningful methods :)
I'm sorry you didn't find value in the explanation of why the refactor may be necessary. I hope others do. Hitting 8 minutes for an ad break is never my focus. However, taking the time necessary to share the info is. The original video was closer to 15 minutes, and I trimmed it as much as I felt good about. But still happened to be longer than 8 minutes Regardless, thank you for watching, and I hope you found something helpful.
@@Beachcasts the content was very helpful and very well presented with great overall production quality. The first 2 minutes or so seemed like a waste of time. Maybe its just me, I have a very low tolerance for videos that talk for ages without really adding anything and then say "so let's jump right in" or words to that affect after they've already wasted loads of time by not "jumping right in". Hopefully the comment above will help people just get straight to the high quality content you produce
@@twiggy99 Thanks for following up, and sharing more detailed thoughts. The timestamps in the description, and chapters in the video, also help folks skip to sections of interest. For those who don't need the "why".
View the entire Basic Refactoring Series at ruclips.net/p/PL6_nF0awZMoNH0_9n_Qjq925IB5RGiB2g
Or watch the previous video in the series, Move Method, at ruclips.net/video/KCVHVuWkihk/видео.html
your explanation is clearly great.
love from India.
Thank you very much
Most welcome!
I know this is a demo about removing temp variables, but this is something I deal with all too often in my own code:
You basically took one loop and made it two loops.
You made the code easier to read and test at the expense of performance.
You basically doubled the loop time.
May not be such a big deal with only 2 sums and a small data set, but what happens when you are dealing with 5 or 6 sums and a larger set?
Is this a worthwhile a trade, in your opinion, or am I making a fool of myself because you handle this subject in another vid?
Thank you for the comment. You are correct. In this simple example, it did cause the loop to be replicated for a total of 3 loops. It likely wouldn't be an issue, unless someone was renting hundreds of movies. However, duplicating the loop 3 times was my mistake while creating the video. I forgot about step 007 in the Refactoring101 repository and should have used Extract Method for the FrequentRenterPoints, prior to Replace Temp With Query. see: github.com/adamculp/refactoring101/blob/master/code/007-extract_method.php (No loop was needed in the new method.) What I did introduces a bug where the points were not properly calculated. :P
Yes, there are better ways to handle the replicated loop, but that was beyond the refactoring example. I would advise to refactor first, then optimize as a separate step, if needed.
Thanks for watching.
@@Beachcasts Let me double down by saying as a general refactoring technique, I totally agree with this notion! Move those temps into meaningful methods :)
@@mikehill2334 Thank you.
We really need you back again
Video actually starts at 2.40. Lots of waffle to hit that 8minite advert barrier
I'm sorry you didn't find value in the explanation of why the refactor may be necessary. I hope others do. Hitting 8 minutes for an ad break is never my focus. However, taking the time necessary to share the info is. The original video was closer to 15 minutes, and I trimmed it as much as I felt good about. But still happened to be longer than 8 minutes
Regardless, thank you for watching, and I hope you found something helpful.
@@Beachcasts the content was very helpful and very well presented with great overall production quality. The first 2 minutes or so seemed like a waste of time. Maybe its just me, I have a very low tolerance for videos that talk for ages without really adding anything and then say "so let's jump right in" or words to that affect after they've already wasted loads of time by not "jumping right in". Hopefully the comment above will help people just get straight to the high quality content you produce
@@twiggy99 Thanks for following up, and sharing more detailed thoughts. The timestamps in the description, and chapters in the video, also help folks skip to sections of interest. For those who don't need the "why".