Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

DI: Useful when just starting out?

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've only recently started getting into Struts development and when I asked for some advice to see if I was on the right path with my initial development, someone responded I might want to look into incorporating things like Dependency Injection into my design.

I've only just learned about DI. How important is it for someone just getting into web application development to start incorporating it? My application is working fine so far without me specifically designing it in. Should I consider going back now and trying to work it in, or wait til I'm more comfortable with designing in Struts and then go back and see where it may be more useful?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like I said--it's probably not important yet. But IMO it's critical for testability, if nothing else.
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recommend you to try to use it. You don't need to go back, you can continue using Struts and try DI maybe by using Spring Framework at the same time.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keith, since you just started with Struts-based GUI development, I would suggest that you stay focused on learning Struts. You can learn about the Dependency Injection design pattern, and once you truly understand how it can be effectively applied, then you might incorporate it in the business applications that you create.

The Struts framework is very solid and there is very little that you can alter here.

 
author
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope you mean Struts2 and not Struts (avoid the latter at all costs!)

As James says, it is important to learn the principles behind DI and they will help you later in your career. However splitting your attention between too many things as you are just starting out may not be ideal. Perhaps learn about it, but decide whether you need to apply it at a later stage.
 
Keith Fiske
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I'm starting with Struts2

Thanks all for the responses!
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree that you should learn concepts of DI before applying it. But please keep in mind that sooner you apply it lesser your work (it case you want to refactor to use DI later).
You have to analyze what is better between 1) Higher cost at first and low cost later and 2) Lower cost at first but higher cost later.
reply
    Bookmark Topic Watch Topic
  • New Topic