タグ

関連タグで絞り込む (2)

タグの絞り込みを解除

DHHとjavaに関するjoltkunのブックマーク (1)

  • Dependency injection is not a virtue in Ruby (DHH)

    By David Heinemeier Hansson on Jan 6, 2013 In languages less open than Ruby, hard-coded class references can make testing tough. If your Java code has Date date = new Date(); buried in its guts, how do you set it to a known value you can then compare against in your tests? Well, you don't. So what you do instead is pass in the date as part of the parameters to your method. You inject the dependenc

    joltkun
    joltkun 2023/03/02
    “If your code never knows exactly who it's talking to, it can talk to anyone! Testing stubs, mocks, and future collaborators. Hogwash.”
  • 1