Ruby dependency injection libraries

前端 未结 3 606
南旧
南旧 2020-12-05 18:11

I\'ve been looking at some Ruby dependency injection libraries. In particularly, I checked out Needle and Copland. They\'ve been around for quite awhile, yet not a lot of

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 18:42

    Jamis Buck, who wrote Copland and Needle, posted here about Needle, dependency injection and their usefulness in a Ruby world.

    It's long but worth reading, but in case you want the single paragraph most relevant to your question, I'd suggest this one, from just before the end:

    DI frameworks are unnecessary. In more rigid environments, they have value. In agile environments like Ruby, not so much. The patterns themselves may still be applicable, but beware of falling into the trap of thinking you need a special tool for everything. Ruby is Play-Doh, remember! Let’s keep it that way.

    HTH

提交回复
热议问题