095 : Room Databases with Florina Muntenescu

In this episode, we talk to Florina from Google about the recently released Database library Room. Room was introduced as part of the Android Architecture components and has been picking up a lot of steam in the community.

Room focuses on being a beautiful api layer to Sqlite. Florina explains to us how we can use Room to create a database, creating entities and how they map to tables using DAOs to access data and even “observe” them. Listen on for more of the details!

Download directly

Show Notes

Official docs

Florina’s posts

360|AnDev talks

Micellaneous questions about Room (that we chopped off for lack of time)

Q: Does Room use reflection?

A: There’s only 1 reflection call (at the time of finding the database implementation, when you call Room.builder). Most of the other stuff is generated code (with compile time verification!).

Q: Does Room provide compile-time SQL checks

A: Yes, Room was designed to provide compile-time checks.

Q: Does Room handle SQL injection attacks (security)

Yes … for all practical purposes. See this post for times when it doesn’t.

Q: Do we have tools to access the sqlite database file directly?

Nope, at the moment, adb is your friend. Use that to download the file manually from your device.

Sponsors

Contact

094: Design Patternitis – 5 Tips to Help You

In this episode of Fragmented, Donn talks about a common problem almost all software engineers face in their career – Design Patternitis.

So, you’ve read the books on design patterns and now you’re applying them everywhere. Just because some code can be put into a pattern doesn’t mean you should. Or should you? How can you apply them when needed? Donn shares 5 tips with you that you can use to help combat Design Patternitis.

Download

Show Notes

Sponsors

This episode is made possible by Kobiton – Fragmented.

They’re giving listeners a 15-day FREE trial with no credit card required! 🙌
Give them a try at Kobiton.com/fragmented and let them know we sent you.

Contact

093 : RxJava intervention with Dan Lew

In this episode of Fragmented, our friend and RxJava paragon of the Android – Dan Lew, returns for a record 3 and 1/2 time.

We’ve been using RxJava over the years now and have even talked to Dan about it in previous episodes.

How has our understanding of Rx use in Android changed over the years? We know some of the super standard usecases for RxJava in AndroidDev. But the important question to be asking is: when are the times we “shouldn’t” be using RxJava? Are we over-complicating our code by shoe-horning it in different places. Concepts like functional programming and reactive state management have picked up steam again, how has this influenced our RxJava use?

Direct download

Show Notes

Sponsors

Kobiton – Fragmented

Contact

092: Learning Kotlin – dealing with static-ness and (companion) objects costs

In this second episode of our learning Kotlin series, we talk about Kotlin’s support for static members or … lack thereof. Kotlin as a language was designed so that there’s no such thing as a “static member” in a class but there are times when having static members can be useful.

So what do we do in those cases? do we just avoid static members? are there better alternatives? what are the costs with some of these approaches?

Listen on to find out more!

Download directly

Show Notes

Static alternatives

Cost of approaches

Look at the end of these notes for code snippets

Misc:

Sponsors

Contact

Code snippets

Cost effectiveness

// ----------------------------------------
// THIS IS BAD
class Foo {
    companion object {
        val myVar = "testing"
    }
}

// calling from Kotlin
Foo.myVar

// calling from Java
Foo.Companion.getMyVar();  // yuck

// ----------------------------------------
// THIS IS OK

// notice the Jvm annotation
class Foo {
    companion object {
        @JvmField val myVar = "testing"
    }
}

// calling from Kotlin
Foo.myVar

// calling from Java
Foo.myVar; 

// ----------------------------------------
// THIS IS AWESOME

// notice the const keyword
class Foo {
    companion object {
        const val myVar = "testing"
    }
}

// calling from Kotlin
Foo.myVar

// calling from Java 
Foo.myVar; 
// compiler additionally inlines this

// myVar is not a primitive or String?
// use @JvmField or @JvmStatic for methods

Package level options

// inside BottomSheetView.Kt
class BottomSheetView {
    companion object {
        const val BOTTOM_SHEET_ANIMATION_TIMING = 500L
    }

    // ...
}


// accessed as:
animation.setTiming(BottomSheetView.BOTTOM_SHEET_ANIMATION_TIMING)

// ----------------------------------------
// INSTEAD DO THIS

// inside BottomSheetView.Kt
const val BOTTOM_SHEET_ANIMATION_TIMING = 500L

class BottomSheetView {
    // ...
}

// accessed as:
animation.setTiming(BottomSheetViewKt.BOTTOM_SHEET_ANIMATION_TIMING)

091 : Decompress – Reddit AMA highlights, package by feature not layer and testing!

In this decompress episode, DF and KG kick it off with a brief discussion of the highlights from the recent reddit AMA that the Android Engineering folk conducted. What were the interesting things they learnt or were surprised by etc.? They then go on to briefly discuss two topics they’ve always chatted about (off-air) packaging by feature (not layer) and most recent thoughts on testing. Listen on to find out more:

Download directly

Show Notes

360 | AnDev

AMA Reddit

Package by feature not layer

Sponsors

Contact