tag:blogger.com,1999:blog-8712770457197348465.post4142467549406282199..comments2024-03-28T18:10:34.431-07:00Comments on Javarevisited: Difference between Dependency Injection and Factory Design Pattern in Java with Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-8712770457197348465.post-51024300077139013032019-09-26T06:40:51.364-07:002019-09-26T06:40:51.364-07:00v well explained, thanksv well explained, thanksArun Singhhttps://www.blogger.com/profile/00145955392915063714noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-89047238197529369012016-04-03T12:26:31.802-07:002016-04-03T12:26:31.802-07:00Thanks a lot, good article.
I wonder, why there i...Thanks a lot, good article. <br />I wonder, why there is only a shy little reference in 4) about the overhead of container configuration ?<br />Maybe because, unlike factory, the configuration can not be tested (because it is not a code), so the user has to deploy and run the application to make sure all instances can be created without exceptions in constructors and/or in container?Anonymoushttps://www.blogger.com/profile/01983952869889169658noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-282457537648723512015-12-24T21:00:21.307-08:002015-12-24T21:00:21.307-08:00@Javin I would suggest to keep the concepts plain ...@Javin I would suggest to keep the concepts plain and simple. Dependency Injection is more of a architectural pattern for loosely coupling software components. Factory pattern is just one way to separate the responsibility of creating objects of other classes to another entity. Factory pattern can be called as a tool to implement DI. Dependency injection can be implemented in many ways like DI SARAL SAXENAhttps://www.blogger.com/profile/01084233786047386880noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-66339876201049080452015-07-11T06:07:28.708-07:002015-07-11T06:07:28.708-07:00A whole blog post. That's will be so cool !
T...A whole blog post. That's will be so cool ! <br />Thanks Anonymoushttps://www.blogger.com/profile/18118490717319019489noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-89470841711900390002015-07-11T04:09:51.717-07:002015-07-11T04:09:51.717-07:00@mateusduboli, Yes, in true sense you can always w...@mateusduboli, Yes, in true sense you can always write code to create, maintain and inject dependencies but as you said a framework like Spring IOC and Google Guice helps a lot. <br /><br />There are many places where optional dependencies are useful e.g. Car class without Audio system, without camera to record anything etc. You can still have a functional car without those accessories. <br /><brjavin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-47704710390922911362015-07-11T04:04:49.640-07:002015-07-11T04:04:49.640-07:00@Elivs Donald Atro, thanks for your comment. Indee...@Elivs Donald Atro, thanks for your comment. Indeed Head First's OOAD is one of the fantastic book for Java developer struggling to understand true essence of Object Oriented programming. It often get unnoticed due to Head First design pattern, another great book. Sure, we'll write about difference between dependency injection and strategy pattern sooner. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-88134132463454876122015-07-02T21:27:23.961-07:002015-07-02T21:27:23.961-07:00Great Post!
But I would like to make some remarks...Great Post!<br /><br />But I would like to make some remarks.<br /><br />A FW it's not needed to achieve DI, it helps a lot, yes, but DI can be achieved without it.<br /><br />DI is about removing the responsibility of controlling the class dependencies from it, so that the dependent class it's not responsible for the creation or retrieval of it's dependencies.<br /><br />I couldn'mateusdubolihttps://www.blogger.com/profile/04060907535559048296noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-26807090026540839412015-06-30T09:17:00.899-07:002015-06-30T09:17:00.899-07:00Hi Javin . That's a good article . You've ...Hi Javin . That's a good article . You've make everything clear. <br />+1 for mentioning Head First's OOAD. I'm starting my journey to Object Oriented Design and I'm glad this book was the first I've picked . It's just goldmine and I don't even understand why it looks so less popular. <br />Now that you've made things clear between DI and Factory, the Anonymoushttps://www.blogger.com/profile/18118490717319019489noreply@blogger.com