Preemptive Pluralization is (Probably) Not Evil
00:01:10 ・ source: https://swyx.io/preemptive-pluralization
Transcript
hostenToday we discuss why planning for multiple items upfront is actually good design.
guestja今日は、最初から複数のアイテムに対応する設計にすることが、実は良い実装方法だという話ですね。
hostenExactly. Many developers assume one user per team, then later need many users per team.
guestjaつまり、最初は『ユーザーは1チームだけ』と思い込むけど、後になって『1ユーザーが複数チームに属すること』が必要になるわけです。
hostenRight, and that refactoring takes months of work and breaks everything.
guestjaそしてその修正には何ヶ月も掛かって、全てのコードとデータベーススキーマを直さなくちゃいけなくなります。
hostenSo instead, just design for multiple items from day one, even if you only need one now.
guestjaだから最初から『これは複数個あるもの』として設計しておけば、後々の変更にも強いコードになるということですね。
hostenThe key insight: changing from one to two is exponentially harder than two to three.
guestja重要なのは、1から2に変えるのは2から3に変えるよりも、指数関数的に難しいってことです。
hostenThis makes your code robust against future requirement changes.
guestjaこうすることで、将来の要件変更に強い、堅牢なコードが書けるようになるんです。