147: Disposing RxJava 2 Streams with AutoDispose

In this short fragment episode, Donn explains how you can clean up your RxJava 2 streams and ensure no memory leaks are occurring by using the AutoDispose library from Uber.

Download

Shownotes

Code Samples

Java

myObservable
    .map(...)
    .as(AutoDispose.<SomeType>autoDisposable(AndroidLifecycleScopeProvider.from(this)))
    .subscribe(...)

Kotlin

myObservable
    .map(...)
    .autoDisposable(AndroidLifcycleScopeProvider.from(this))
    .subscribe(...)

With Scope Event Provided

myObservable
    .map(...)
    .autoDisposable(AndroidLifcycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY))
    .subscribe(...)

Testing

// File: CustomerService.kt
class CustomerService @Inject constructor(...) {
    lateinit var scopeProvider: ScopeProvider
}

// Usage in Fragment/Activity/etc
val service = CustomerService(...).apply {
    scopeProvider = AndroidLifecycleScopeProvider.from(this)
}

// Usage in Test
val service = CustomerService(...).apply {
    scopeProvider = TestScopeProvider.create()
}

Contact

146: 3 Things Every Android Developer Needs to Know

In this episode of Fragmented, Donn digs into three things that every Android developer needs to know.

Download

  • Dependency Injection

    1. Constructor_setter_method injection
    2. Service Locators or other DI frameworks
    3. Common Frameworks
      1. Dagger
      2. Koin
      3. Kodein
      4. ToothPick
  • How to test

    1. Functional / System
    2. Integration
    3. Unit
    4. Tools:
      1. jUnit
      2. Espresso
      3. Spek
  • Keep it simple simple

    1. KISS principle KISS principle – Wikipedia
    2. Examples
      1. Code Duplication
        1. “Extract this into a method”
      2. Lets create a framework for this
      3. Kaushik’s – 3x rule
        • if something is duplicated 3 or more times, think about extracting it
      4. 3/6 Rule – In 6 months, will I be able to understand this in under 3 minutes?

Contact

Fragmented Discord Chat Server

Kaushik and I are excited to announce that we’ve created a public Discord server that you can join, for free to chat with other folks in the community.

We wanted to create a place where listeners could get together, ask questions, communicate and help each other. The goal of our podcast has always been to share knowledge and we feel that this is only a natural extension of our original vision.

Join Here

You can join the discord group by installing the Discord app and joining the server via the link below.

Why didn’t you use Slack?

This is a great question, and one that we grappled with for a bit. Ultimately it came down to the fact that Slack has a 10,000 message limit on the free plan. This severely limits the usefulness of Slack (in our opinions). Without message history its a limited chat. With history, it provides a rich history of searchable content for the community.

Therefore we decided to go with Discord. It is free to use and has unlimited message history that can be searched.

Why didn’t you use Telegram? Discord is mainly for gamers …

Discord allows us to have various channels/rooms where discussions can be broken out into. We have rooms for design, testing, architecture, etc. Using Telegram, this would not be possible.

While Discord is very popular for gamers, it is used widely in various other industries as well.

Code of Conduct

We do our best to model ourselves as responsible stewards of the community and in doing such we have established a code of conduct that all members of the discord server must abide by. Read it here.

As always, please let us know if you have any comments, questions, etc.

-✌️ Donn & Kaushik

137: Decompress KISS DRY Testing

In this episode, DF and KG decompress. They start off talking about ideas around KISS vs DRY in software engineering. They move on then to talk about a dear topic – functional vs unit testing and then dive into some of the woes of having a testing infrastructure spun up. Also announcing our youtube channel!

Download

Sponsors

Contact

136: Kotlin Extension Functions

In this fragment episode, Donn talks about Kotlin extension functions. He discusses what they are, how to build them, why they’re useful, how to organize them, visibility and how to call them Java and much more.

Download

Show Notes

`

import android.view.View

fun View.gone() {
    this.visibility = View.GONE
}

fun View.visible() {
    this.visibility = View.VISIBLE
}

`

Contact