Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unlocking The Power of Kotlin Channels

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Unlocking The Power of Kotlin Channels

The documentation to support my video about Kotlin Channels and flows that you can find here: https://www.youtube.com/watch?v=oEffjtSVAcc. In this video and with this supporting document I am telling a story of how we can use flows and channels. To explain flows I use the examples of coffee in water and boats on the water. A pretty different example that I thought at the time would help people understand Flows and Channels in Kotlin.

More Decks by João Filipe Sabino Esperancinha

Other Decks in Programming

Transcript

  1. Escape the Ordinary: Unlocking the Power of Kotlin Channels through

    Coffee, Boats,and Water Streams! A Lightning Presentation (support slides 2023) By João Esperancinha (2024/03/15)
  2. Who am I? Software Engineer for 10+ years, mostly in

    Java and half a decade in Kotlin. Studied at ISEL Lisboa in Computer Science and Telecom Engineering, Spring Professional 2020, OCP11 and Kong Champion
  3. Flows and Channels • Flows • Channels Are used asynchronously

    in suspend functions to produce and consume values in an iterative way to and from a channel. It is defined as a primitive with non-blocking properties that provides an implementation of a SendChannel, to send(produce) data and an implementation of a ReceiveChannel, to receive(consume) data. • Hot Flow • Cold Flow A set of chained operations designed to be called once and quickly return A stream that continuously emit data, regardless of whether the of any consumer being subscribed to it.
  4. Resources • About Coroutines ◦ https://kotlinlang.org/docs/coroutines-overview.html ◦ https://kotlinlang.org/docs/multiplatform-mobile-concurrency-and-coroutines.html ◦ https://www.tibco.com/reference-center/what-is-data-streaming

    ◦ https://dictionary.cambridge.org/dictionary/english/canal ◦ https://dictionary.cambridge.org/dictionary/english/channel ◦ https://kotlinlang.org/docs/channels.html#buffered-channels • About Hogweed: ◦ - https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5729142/ ◦ - https://www.invasivespeciescentre.ca/invasive-species/meet-the-species/invasive-plants/giant-hogweed/
  5. Codebase • Source Repository ◦ https://github.com/jesperancinha/asnsei-the-right-waf • Location Directory: ◦

    https://github.com/jesperancinha/asnsei-the-right-waf/tree/main/demo-projects/library-channels Use git clone from the command prompt to download the full code base: > git clone https://github.com/jesperancinha/asnsei-the-right-waf.git You’ll be prompted for a username and password which should be your github account. > cd /demo-projects/library-channels The easy way: > make b > make run The manual way: > gradle build > ./gradlew bootRun
  6. About me • Homepage - https://joaofilipesabinoesperancinha.nl • LinkedIn - https://www.linkedin.com/in/joaoesperancinha/

    • YouTube - JESPROTECH ▪ https://www.youtube.com/channel/UCzS_JK7QsZ7ZH-zTc5kBX_g ▪ https://www.youtube.com/@jesprotech • Bluesky - https://bsky.app/profile/jesperancinha.bsky.social • Mastodon - https://masto.ai/@jesperancinha • GitHub - https://github.com/jesperancinha • Hackernoon - https://hackernoon.com/u/jesperancinha • DevTO - https://dev.to/jofisaes • Medium - https://medium.com/@jofisaes