Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better documentation for users inexperienced with DI #5837

Open
gmethvin opened this issue Mar 9, 2016 · 8 comments
Open

Better documentation for users inexperienced with DI #5837

gmethvin opened this issue Mar 9, 2016 · 8 comments

Comments

@gmethvin
Copy link
Member

gmethvin commented Mar 9, 2016

I'm seeing a lot of confused users on the mailing list trying to do things like inject static members to their class. I feel like the documentation (especially JavaDependencyInjection) assumes way too much about what people know about dependency injection, it's benefits, and the mechanics of how it works. In addition to that, Play didn't really address why its philosophy changed so much.

@marcospereira
Copy link
Member

Guice docs can help a lot here:

  1. https://github.com/google/guice/wiki/Motivation
  2. https://github.com/google/guice/wiki/GettingStarted
  3. https://github.com/google/guice/wiki/MinimizeMutability

@wsargent
Copy link
Member

The "why" of dependency injection and Play is described here:

https://www.playframework.com/documentation/2.5.x/Highlights24#Dependency-Injection

@sebtomba
Copy link

This is perhaps a quite specific question in this context, but how can I actually inject my own actor system into AkkaGuiceSupport instead of the built in one (for bindActor and bindActorFactory)? This topic in the current Play documentation is not clear to me.

@wsargent
Copy link
Member

Also see #4589

@nigrij
Copy link

nigrij commented Apr 8, 2016

I think you are missing the point of the people on the mailing list. You're focused on the benefits of using DI, but the confused people in the mailing list concerned with HOW to use play and DI not the benefits of using it, ie. the WHY. If it is now a requirement of using Play to use DI in your application code, then specific documentation of how to use DI with Play that assumes no knowledge of DI is needed. Otherwise, people new to play and/or new to DI will be confused and have trouble using play.

@wsargent
Copy link
Member

wsargent commented Apr 8, 2016

@nigrij what do you think is the best way for people to learn about dependency injection if they don't know it? How do most people get started?

@gmethvin
Copy link
Member Author

gmethvin commented Apr 8, 2016

The Guice wiki does a good job of explaining DI from the ground up. Even just linking the Guice getting started page and explaining that Play creates an Application from the injector (which depends on the router, which depends on controllers, etc.) would help a lot of people.

I also think using field injection in the docs for Java is a bad idea. If the DI magic can easily be replaced by constructor calls it makes DI much easier to understand for beginners.

@wsargent
Copy link
Member

wsargent commented Apr 9, 2016

Also see #4602

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants