Solving Gilded Rose Kata (No Nesting) | Refactoring Challenge #2

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024

Комментарии • 11

  • @Blindside328
    @Blindside328 3 года назад +3

    Ah the result of rubber ducking for many years! Great stuff man, love how I feel like I'm pairing with you.

  • @explode1507
    @explode1507 3 года назад +1

    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?

    • @craftvscruft8060
      @craftvscruft8060  3 года назад +1

      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.

  • @felipealvarez1982
    @felipealvarez1982 2 года назад +2

    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!

    • @craftvscruft8060
      @craftvscruft8060  2 года назад +1

      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

  • @victorhe6139
    @victorhe6139 2 года назад

    Awesome walkthrough!

  • @kugacz
    @kugacz 3 года назад +1

    Other refactor approach: ruclips.net/video/8bZh5LMaSmE/видео.html

    • @craftvscruft8060
      @craftvscruft8060  2 года назад

      Thanks Marek! Sandi has great techniques, I'm a fan.

  • @MikeFinney
    @MikeFinney 3 года назад

    Good stuff