[LRUG] Improve your code with dependency injection talk
Stephen Best
bestie at gmail.com
Tue Aug 13 11:13:01 PDT 2013
Good evening LRUG
Thanks again to all of you that came and sat through my talk, especially
those that offered feedback.
As promised the slides can be found here on Speakerdeck.
https://speakerdeck.com/bestie/improve-your-ruby-code-with-dependency-injection
I was challenged on a couple of points about default args and hash fetch
with a block, so I thought I'd take the opportunity to clarify.
* I do use an args hash and Hash#fetch ALL THE TIME
* I almost never use the block for a default value, I always prefer my
objects to be given what they need rather than have them pull it in. A
default argument or a default block is a hack for when you don't have or
want a container / parent object.
I also got another question about whether to start a project like this or
refactor to it.
I think that either way is fine as I don't think my approach adds a huge
amount of code. It really comes down to you and your team, your tolerance
for many small simple objects over fewer larger ones and your ambitions for
the project.
I love arguing about these things and I'd love to grab a coffee with anyone
else who wants to discuss. I'm with Cambridge Healthcare (howareyou.com) at
Google Campus so get in touch.
Cheers!
Stephen Best
Ruby / Javascript developer, Ember.js evangelist.
+44 7745 790523
linkd.in/stephenbest
github.com/bestie
@thebestie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130813/b2cc52df/attachment-0003.html>
More information about the Chat
mailing list