The power of preparatory refactoring - Martin Fowler

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ธ.ค. 2024

ความคิดเห็น • 15

  • @wknight8111
    @wknight8111 หลายเดือนก่อน +19

    I always tell my team that a PR should contain at least 2 commits: 1 to implement your feature or fix your bug, and 1 to clean. It doesn't usually matter to me which order they happen in. You can refactor first, in order to make your feature easier to implement. Or you can refactor last, and make it look like your feature was always part of the design. So many inexperienced and middling coders are content to just stuff another if/else block in an existing method, and when you add these up over time you end up with garbage unmaintainable code.

    • @codefinity
      @codefinity 29 วันที่ผ่านมา

      Wow, you must be running a great team! ❤

    • @igorshingelevich7627
      @igorshingelevich7627 26 วันที่ผ่านมา

      So all your team members can clearly look in the future and make a code, that will be good enough for tomorrow's changes. Sounds like a dream? Or like OOP?

    • @wknight8111
      @wknight8111 25 วันที่ผ่านมา +1

      @@igorshingelevich7627 I never said anything about seeing the future, and I certainly don't have that ability.

  • @magnusmalmborn8665
    @magnusmalmborn8665 หลายเดือนก่อน +19

    It's also easier on the reviewers to have two changes, one that just reorganizes the code but keeps the function, and one that changes the functionality in hopefully concise ways.

  • @arnthorsnaer
    @arnthorsnaer หลายเดือนก่อน +8

    Incredibly good advice which I’ve practiced for years and has resulted in healthy and malleable codebases and a fearlessness towards them. The refactoring is not a sign of some bad decision in the past, it’s a sign of an healthy codebase. A codebase which can no longer be refactored is emblematic of fear and stagnation.

  • @gauravdubey3071
    @gauravdubey3071 หลายเดือนก่อน +3

    Spent the last week doing this. It behaves exactly the same - but now we can actually add new features!

  • @auxmobile
    @auxmobile หลายเดือนก่อน +9

    This is actually what causes the evolution of programming languages. If we hadn't addressed that need for 'preparatory refactoring' in a more systemic way, we would still be writing programs in machine code.

  • @StefanErwinBaumer
    @StefanErwinBaumer หลายเดือนก่อน +8

    I read the title as "predatory" refactoring and the concept presented is a lot less exciting than I had hoped for, though still great advice

    • @AlessAbreu
      @AlessAbreu หลายเดือนก่อน

      lol

  • @javastream5015
    @javastream5015 29 วันที่ผ่านมา +1

    It depends. But overall refactoring produce massive gains in the majority of the cases.
    In the minority you end up in a disaster or over-engineering.
    Developer with 20+ years here.

  • @EricPeelMusic
    @EricPeelMusic หลายเดือนก่อน

    Agreed.

  • @InconspicuousChap
    @InconspicuousChap หลายเดือนก่อน +5

    There is an old principle "Design before you implement". By trying to put a stake in the ground before anyone else does the business has transformed IT into a sloppy coding factory, working in continuous rush (stupid sprints and such) and never having time to think. Now the world has billions lines of shitty software, and the whole competition has been reduced to who produces the most shit in a given amount of time.

  • @personalaccount1515
    @personalaccount1515 หลายเดือนก่อน

    First