Errata for Dagger by Tutorials, 1st ed

Creating this topic to catch any typos and bugs in the 1st Edition of Dagger by Tutorials.

On Chapter 9 (More About Module), when you say “On the other hand, a @Provider”, don’t you mean @Provides?

Section 1, Chapter 5:

In The BusStopListPresenter implementation, point 1:
“You’re using constructor injection to note that you’ll pass the BusStopListViewBinder later,…” - Should it be field injection?

In Key Points it says:
“…you’ve achieved a lot by applying an architectural pattern, Model View Controller, to the Busso App.” - Should it be Model View Presenter.

Cheers

feedback from member in Chapter 3:

Just wanted to mention that https://www.raywenderlich.com/books/dagger-by-tutorials/v1.0.ea1/chapters/3-dependency-injection repeatedly mentions AppCompactActivity where it should be AppCompatActivity

Found a typo on page 165: “srcDic” should be “srcDir”.

In chapter 6, the DaggerServerRepository starter project defines Data as class Data, it should probably be data class Data(val name: String) because main is later edited to call server.receive(Data("Hello")).

  • In chapter 7, one of the unit tests in NaturalSequenceGeneratorTest.kt has a typo in the method name: “test natural sequence value starting in diffenet value”.

  • Page 186 says “Dagger doesn’t need to know anything about how to create the instance of SequenceViewBinderImpl”. Since the code in question calls the SequenceViewBinderImpl constructor explicitly, I don’t see how this makes sense. Maybe it should be “Dagger doesn’t need to know anything about how to create the instance of SequenceViewBinder.Listener”.

  • The UML diagram on page 189 shows class name BasePresenterPresenter instead of BasePresenter.

  • Page 195 says “[…] the app still doesn’t work! It doesn’t crash, but […]”.
    This is incorrect. The app does crash, because in the starter project, SequencePresenterImpl.displayNextValue is implemented as

  override fun displayNextValue() {
    sequenceViewBinder.showNextValue(sequenceModel.next())
  }

instead of

  override fun displayNextValue() {
    useViewBinder {
      showNextValue(sequenceModel.next())
    }
  }

as shown in the final project and in the book.

The sequenceViewBinder field is not initialised anywhere and can be removed.

  • The method injection approach shown on page 199 requires changing sequenceViewListener.onNextValuePressed() to sequenceViewListener?.onNextValuePressed() in SequenceViewBinderImpl.init.

  • Page 204 says “open the RaySequence project from in the starter folder”, looks like either “from” or “in” is superfluous.

  • Page 210 says “you’ll get a new source tag”, that should probably be “you’ll get a new source tab”.

  • Page 213 says “select the No Filter option”, should be “select the No Filters option”.

  • Page 255 has a typo in the chapter title: “SplashViewBinde” should be “SplashViewBinder”
  • Page 269: “you need to use @Inject the primary constructor” should be e.g. “you need to use @Inject on the primary constructor”
  • Page 291: Should use CACHE_SIZE instead of hard-coding 100 * 1024L
  • Page 292: typo in “provideCache” in list item 1
  • Page 307: BusStopFragment.kt should be BusArrivalFragment.kt
  • Page 336: Running the app shows sometimes “ClassCastException: LocationNotAvailable cannot be cast to LocationData”. This typically occurs when running in the emulator,
    and the emulator has just been started due to launching the app.
  • Page 347: Says WhereIAm twice instead of WhereAmI
  • Page 349: “you don’t need inject() in the Main parameter of ApplicationComponent” sounds wrong
  • Page 351: The image title says WhereIAm instead of WhereAmI
  • Page 353 says plugins.wether.endpoint instead of plugins.weather.endpoint
  • Source code for chapter 14: Package name should be plugins.weather instead of plugins.wether
  • Page 373: “The type for the key is same” should be “The type for the key is the same”
  • Page 421 says “Create a new package named ui.fragments”, this should be “Create a new package named di.fragments”
  • Page 433: The first sentence “In the previous chapter […]” seems to be missing a word
  • Page 437: List item 1 says ext.hilt_version needs to be added to the starter project, but it is already there
  • Page 473: The intermediate title says “VieModel” instead of “ViewModel”
  • Page 518: “your continued Kotlin and saving data on Android” sounds strange
  • Page 259 says “di.injectos package”, should be “di.inject.os package”.

Chapter 11: Components & Scopes, page 282

possible typo writing proviitsdeCache() instead of provideCache() in point 1.

Chapter 11: Components & Scopes, page 297

It refers to BusStopFragment.kt while the image and task are meant for BusArrivalFragment

Chapter 12: Components dependencies, page 316

The first image on the page is making a reference to a modification that doesn’t take place until the next step.

 fun activityComponentBuilder(): ActivityComponent.Builder 

The next image is still using ActivityComponent.Factory
Changing it to Builder is the subject of the next section