Skip to content

Commit 29725c7

Browse files
vkryachkorlazo
andauthored
Apply suggestions from code review
Co-authored-by: Rodrigo Lazo <[email protected]>
1 parent 72ff8cd commit 29725c7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

contributor-docs/best_practices/dependency_injection.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ parent: Best Practices
66

77
While [Firebase Components]({{ site.baseurl }}{% link components/components.md %}) provides basic
88
Dependency Injection capabilities for interop between Firebase SDKs, it's not ideal as a general purpose
9-
DI framework or a couple of reasons, to name a few:
9+
DI framework for a few reasons, to name some:
1010

1111
* It's verbose, i.e. requires manually specifying dependencies and constructing instances of components in Component
1212
definitions.
@@ -15,8 +15,8 @@ DI framework or a couple of reasons, to name a few:
1515
As a result using [Firebase Components]({{ site.baseurl }}{% link components/components.md %}) is appropriate only
1616
for inter-SDK injection and scoping instances per `FirebaseApp`.
1717

18-
On the other hand, manually instantiating SDKs is often tedious, errorprone, and often leads to code smells
19-
that make code less testable and coulpes it to implementation rather than the interface. For more context see
18+
On the other hand, manually instantiating SDKs is often tedious, errorprone, and leads to code smells
19+
that make code less testable and couples it to the implementation rather than the interface. For more context see
2020
[Dependency Injection](https://en.wikipedia.org/wiki/Dependency_injection) and [Motivation](https://github.com/google/guice/wiki/Motivation).
2121

2222
{: .important }
@@ -29,13 +29,13 @@ See: [Dagger docs](https://dagger.dev)
2929
See: [Dagger tutorial](https://dagger.dev/tutorial/)
3030

3131
{: .highlight }
32-
While Hilt is the recommended way to use dagger in Android `applications, it's not suitable for SDK/library development.
32+
While Hilt is the recommended way to use dagger in Android applications, it's not suitable for SDK/library development.
3333

3434
## How to get started
3535

36-
Since [Dagger](https://dagger.dev) does not strictly follow semver and requires the dagger-compiler version to match with the dagger library version,
36+
Since [Dagger](https://dagger.dev) does not strictly follow semver and requires the dagger-compiler version to match the dagger library version,
3737
it's not safe to depend on it via a pom level dependency, see [This comment](https://github.com/firebase/firebase-android-sdk/issues/1677#issuecomment-645669608) for context. For this reason in Firebase SDKs we "vendor/repackage" Dagger into the SDK itself under
38-
`com.google.firebase.{sdkname}.dagger`, while it incurs a size increase, it's usually on the order of a couple of KB and is considered
38+
`com.google.firebase.{sdkname}.dagger`. While it incurs in a size increase, it's usually on the order of a couple of KB and is considered
3939
negligible.
4040

4141
To use Dagger in your SDK use the following in your Gradle build file:
@@ -82,7 +82,7 @@ Here's a simple way to define the dagger component:
8282
@Component(modules = MySdkComponent.MainModule::class)
8383
@Singleton
8484
interface MySdkComponent {
85-
// Informs dagger that this is one of the type that we want to be able to create
85+
// Informs dagger that this is one of the types we want to be able to create
8686
// In this example we only care about MySdk
8787
fun getMySdk() : MySdk
8888
@@ -122,7 +122,7 @@ class MySdkInteropAdapter @Inject constructor(private val interop: com.google.fi
122122
123123
## Scope
124124
125-
Unline Component, Dagger does not use singleton scope by default and instead injects a new instance of a type at each injection point,
125+
Unlike Component, Dagger does not use singleton scope by default and instead injects a new instance of a type at each injection point,
126126
in the example above we want `MySdk` and `MySdkInteropAdapter` to be singletons so they are are annotated with `@Singleton`.
127127
128128
See [Scoped bindings](https://dagger.dev/dev-guide/#singletons-and-scoped-bindings) for more details.

0 commit comments

Comments
 (0)