Yes, since updateBackstagePassQuality() method can potentially increment (by 1) 2 or 3 times, I think this will result in the behavior you've described and the tests confirm it. So if I understand you correctly, this is if anything a readability issue. We could imagine determining the increment amount (1, 2 or 3) and then doing the update in a separate step, might be better.
I hope you wrote your own unit tests, as you would have had to do if this were actually a real legacy code refactoring assignment. I think it could be even more valuable if you finish all of the refactoring first, then you show exactly HOW EASY it is to add the Conjured case. Then the code becomes maintainable and extensible!
Hi Felipe, I agree that's frequently a part of the process. My favorite resource on bootstrapping testability is "Working Effectively With Legacy Code" by Michael Feathers. While this video was focused more on demonstrating the disciplined refactoring steps, I have two other videos that show introducing the same snapshot/golden-file style of tests used: "Testing a donut" ruclips.net/video/EUEFaswd5L8/видео.html "Refactoring a Lisp Interpreter" ruclips.net/video/_ryuXtoEb6g/видео.html
Ah the result of rubber ducking for many years! Great stuff man, love how I feel like I'm pairing with you.
Totally the feel I was looking for! Thanks
35:34 update backstage pass quality, shouldn't it be then sell in < 11 quality increase 2 times faster, so +2 and +3 then sell in < 6?
Yes, since updateBackstagePassQuality() method can potentially increment (by 1) 2 or 3 times, I think this will result in the behavior you've described and the tests confirm it. So if I understand you correctly, this is if anything a readability issue. We could imagine determining the increment amount (1, 2 or 3) and then doing the update in a separate step, might be better.
I hope you wrote your own unit tests, as you would have had to do if this were actually a real legacy code refactoring assignment. I think it could be even more valuable if you finish all of the refactoring first, then you show exactly HOW EASY it is to add the Conjured case. Then the code becomes maintainable and extensible!
Hi Felipe, I agree that's frequently a part of the process. My favorite resource on bootstrapping testability is "Working Effectively With Legacy Code" by Michael Feathers. While this video was focused more on demonstrating the disciplined refactoring steps, I have two other videos that show introducing the same snapshot/golden-file style of tests used:
"Testing a donut"
ruclips.net/video/EUEFaswd5L8/видео.html
"Refactoring a Lisp Interpreter"
ruclips.net/video/_ryuXtoEb6g/видео.html
Awesome walkthrough!
Thanks, Victor!
Other refactor approach: ruclips.net/video/8bZh5LMaSmE/видео.html
Thanks Marek! Sandi has great techniques, I'm a fan.
Good stuff