Skip to content

smithjustinn84-netizen/notebooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Kotlin Coroutines Notebooks

A collection of interactive Kotlin notebooks demonstrating coroutines concepts and patterns using JetBrains Kotlin Notebook.

πŸ“‹ Overview

This repository contains hands-on examples and tutorials for learning Kotlin coroutines through interactive notebooks. Each notebook focuses on specific coroutines concepts with practical, runnable code examples.

πŸ“š Notebooks

Coroutines/

πŸš€ Key Topics Covered

  • Basic Coroutines: launch, runBlocking, async/await
  • Structured Concurrency: coroutineScope, parent-child relationships
  • Cancellation: Explicit cancellation, timeouts, cleanup
  • Context Switching: withContext, Dispatchers
  • Flow: Cold streams, operators, collection
  • Exception Handling: Error propagation, structured exception handling
  • Supervision: SupervisorJob, fault tolerance

πŸ› οΈ Requirements

  • JetBrains IntelliJ IDEA or JetBrains DataSpell with Kotlin Notebook support
  • Kotlin 1.8+
  • kotlinx-coroutines-core 1.8.1+ (automatically managed via @file:DependsOn)

πŸƒ Getting Started

  1. Clone the repository:

    git clone https://github.com/smithjustinn84-netizen/notebooks.git
    cd notebooks
  2. Open in JetBrains IDE:

    • Open the project in IntelliJ IDEA or DataSpell
    • Navigate to the Coroutines/ directory
    • Open any .ipynb file to start learning
  3. Run the notebooks:

    • Execute cells individually to see coroutines in action
    • Modify examples to experiment with different patterns
    • Dependencies are automatically resolved via @file:DependsOn

πŸ“– Learning Path

For beginners, we recommend following this order:

  1. basics.ipynb - Start here for fundamental concepts
  2. 101_kotlin_coroutines.ipynb - Comprehensive overview
  3. cancellation_basics.ipynb - Understanding cancellation
  4. exceptions.ipynb - Error handling patterns
  5. flows.ipynb - Reactive streams with Flow
  6. supervisor_job_and_scope.ipynb - Advanced scope management

πŸ”§ Interactive Features

Each notebook includes:

  • βœ… Runnable code examples with real output
  • βœ… Detailed explanations of coroutine concepts
  • βœ… Timing measurements to understand concurrency benefits
  • βœ… Exception handling demonstrations
  • βœ… Best practices and common patterns

🀝 Contributing

Feel free to:

  • Add new notebook examples
  • Improve existing explanations
  • Fix any issues you encounter
  • Suggest new coroutines topics to cover

πŸ“ Notes

  • All notebooks use runBlocking for demo purposes in a notebook environment
  • In production apps, prefer structured concurrency with proper scope management
  • Examples include timing measurements to demonstrate concurrent execution
  • Dependencies are managed automatically via notebook annotations

πŸ”— Resources


Happy Learning! πŸŽ‰ Explore the world of asynchronous programming with Kotlin coroutines through these interactive examples.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published