tag:blogger.com,1999:blog-6183900941768438671.post2323107348019718725..comments2022-03-24T23:09:49.838-07:00Comments on Random Tech Stuff: Loose Dependency InjectionGabe Nellhttp://www.blogger.com/profile/11777013948807774469noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-6183900941768438671.post-84833390048483759722009-12-21T10:25:15.140-08:002009-12-21T10:25:15.140-08:00I think it would depend on the nature of the helpe...I think it would depend on the nature of the helper class. In this case we could do that, since the TempFileFactory is stateless. But if it were something which kept state, we'd need a new instance every time. <br /><br />This is a good callout though; we're paying an additional cost at construction time with this approach, so it should be used with caution in scenarios where we'd be creating the outer class in a tight loop or something.Gabe Nellhttps://www.blogger.com/profile/11777013948807774469noreply@blogger.comtag:blogger.com,1999:blog-6183900941768438671.post-69730025564006868142009-12-20T23:09:35.420-08:002009-12-20T23:09:35.420-08:00Nice. I guess in this case there probably isn'...Nice. I guess in this case there probably isn't much performance penalty by doing it this way but I wonder if you could squeeze out a little extra optimization for consumers by moving the assignment from the public constructor to a static initializer block?Faizalhttps://www.blogger.com/profile/13578238776442140414noreply@blogger.com