강의

멘토링

로드맵

Inflearn brand logo image
Programming

/

Back-end

Practical Kotlin Coroutine Master Class: Close to Fundamentals and True to Basics

This course is a master class that teaches Kotlin's 🌺 Coroutine, covering everything from theoretical foundations to practical application in a standard manner. It systematically covers core principles and structure, the necessity of asynchronous programming, Coroutine builders and scopes, exception handling, channels, Flow, and other key features frequently used in practice, step by step. Each concept is explained with hands-on examples, making it easy for beginners to understand and immediately apply them. This is the best introductory and practical course for developers who want to build strong Coroutine skills for real-world use.

(4.9) 10 reviews

61 learners

  • Hong
코틀린
코루틴
Android
Kotlin
concurrent
backend
coroutine

Reviews from Early Learners

What you will learn!

  • Minimum Basic Kotlin Syntax

  • Advantages and disadvantages of multi-threading, and accordingly, how to utilize coroutines

  • Structured Concurrency and Practical Patterns in Coroutines

  • From Basic to Advanced Exception Handling Methods in Coroutines

  • Management of Shared Resources in Parallel Programming

  • Method for Streaming Event Data Using Flow

  • Shared resource management between lightweight threads using Channels

Coroutines introduced by developers of large companies based on the classics

There is no longer a need for lectures that simply teach the operating principles of coroutines. Experience various cases and practical codes that can be used immediately in practice that actual developers at large companies have encountered and applied in the field through this lecture.


This lecture covers the basic concepts of coroutines, as well as tools that are widely used in practice, such as Flow, Channel, Dispatcher, and Scope, with examples. You can learn naturally through practical function implementation examples, from simple API calls to complex asynchronous logic, child-parent relationships, job management, and even exception handling.


While many materials remain theoretical, this lecture aims to properly inform you of 'why it should be written this way' , 'where problems arise' , and 'how to solve them' in a practical development environment.

We will not just end with theory, but will teach you technologies that can be applied to actual services, patterns and know-how actually used by practitioners, and writing methods that avoid mistakes.

Why should I learn coroutines?

It makes no sense to learn coroutines simply because they are “asynchronous processing” or because they are a “trend.”

The realistic reason why you need to know coroutines is "practical efficiency" and "competitiveness".


When working, there are many tasks that take a long time, such as API calls, DB transactions, and external system connections.

If we try to handle all of this with threads, resources are limited, and if we configure it with callbacks, it is difficult to manage.

Coroutines are used in various ways, not limited to Android and backend.. RxJava, callback hell, complex synchronization issues... Those who have already experienced it will have felt firsthand, "This is why coroutines are needed."

📚 Complex asynchronous logic can be made as simple as synchronous code

In the past, if you wanted to process multiple tasks asynchronously, you had to use various techniques such as callbacks, threads, and Futures. However, this method made the code complicated, and with just one 'suspend' keyword, you can mix asynchronous and synchronous tasks, greatly improving readability and maintainability.

📚 Maximize server resource efficiency

If you create multiple threads to handle concurrency, server resources can quickly be exhausted and performance can deteriorate. Coroutines handle thousands to tens of thousands of tasks with a small number of threads, so you can efficiently utilize server resources. For example, when handling large numbers of network requests or data input/output concurrently, it can handle many more requests than thread-based.

📚 Manage safely with structured concurrency

Coroutines manage the lifecycle of tasks in a parent-child relationship. When the parent coroutine terminates, the child coroutine is automatically cleaned up, preventing resource leaks or unexpected behavior. This structured concurrency enables predictable behavior and stable server operation even in large-scale services.

📚 Intuitive error handling and cancellation

When an exception occurs in asynchronous code, it is often difficult to know where and how to handle it. Coroutines provide consistent support for exception propagation, error handling, and task cancellation (cancellation tokens, etc.). It allows you to handle error situations commonly encountered in practice much more simply and safely.

📚 Real-time data streams and event processing

By utilizing Flow and Channel of coroutine, Processing complex events such as real-time data streams, chats, sensor data, and real-time notifications It can be implemented with concise and readable code. Instead of attaching a callback every time an event occurs, Flow allows you to work with data declaratively and reactively.

After taking the lecture, you can create results like this.

Asynchronous processing code that can be applied directly to practice

It allows you to write narrow asynchronous flows as concisely as synchronous code.

Create reliable and efficient coroutine-based code that can be used in real-world services right away, without callback hell or complex thread management!

Designing a Structured Concurrency Architecture

You can incorporate the Structured Concurrency pattern into your project, which safely manages multiple asynchronous tasks in a parent-child relationship, rather than just a single task.

Through this, you will learn how to handle large volumes of traffic or complex data flows reliably.

Real-time data stream and event processing system

Leverage Coroutine's unique tools, such as Flow and Channel, to implement essential features found in various event-based systems, such as chat, data pipelines, and log analyzers!

Stable exception and cancellation handling

Let's learn how to safely handle common errors, exception propagation, and task cancellation issues that we frequently encounter in practice by writing practical code using coroutines!

Easy to maintain, readable code

We provide a clean and consistent code style that allows you to understand even complex asynchronous/concurrent logic at a glance. With this, you can develop the skills essential for practical work such as collaboration with team members, code review, and feature expansion!

Learning using about 30 practical example codes

This course is not a lecture that consists solely of theory or words, but is prepared as a course in which you learn by implementing simple or advanced functions.

Four Values That Knowledge Sharers Value

1. Lectures must be humane.

I don't think a lecture that is easy to show is a lecture, even if it is considered unprofessional. Debugging time is also part of the lecture.

2. It must be specialized for practical work.

Development is not something you just talk about. You can actually implement it and go through the process of making it work.

  • Planners... please save me...


3. It must be helpful to students.

I wanted to incorporate concepts that I have applied and seen effective in my field. Through this process, you can indirectly experience the field, or if you are a practitioner, you can demonstrate better performance in the field environment.

4. The lecture is not over.

I hope you leave many questions and answers as you go through the lecture. This lecture was not created solely based on my knowledge. It also includes opinions from developers at various large companies.

  • Here are some brief biographies of those who helped in completing this lecture:

private val supported_one = "Kakao Pay Platform Backend Developer" private val supported_two = "Toss Securities API Server Developer" private val supported_three = "Unicorn startup developer who asked to keep it a secret"

Lecture Structure

📚 Section 1

Along with the introduction to the lecture, I would like to compare and explain the differences between lightweight threads that you can easily use, such as coroutines, and threads that are managed by the OS and allocated with resources.

print ( "⚠️ Important points that Kakao Pay platform backend developers think about!! ⚠️" ) You can develop without knowing the difference between threads and lightweight threads. However, if you are preparing for a job change or employment, this is a great topic to prepare for an interview! It is a simple content, but you can learn the simple content right away through this time!

📚 Section 2

We'll go over some very basic coroutine declarations and working code. It's a very basic topic, and we're providing it to you as a warm-up.

📚 Section 3

You will learn how to manage the life cycle of a coroutine. You will learn about various real-world examples of coroutine cancellation and Gracefully Shut Down, and manage events related to coroutine cancellation!

📚 Section 4

In using concurrent programming, you will implement an explicit code form that returns and uses values. In addition, we have prepared a time for you to understand and learn the basic coroutine structure called parent-child relationship!

📚 Section 5

This is a time to theoretically understand the Dispatcher and Context used inside coroutines and learn by applying various Dispatchers. It is not required!! But I prepared it as a time to know for optimization.

📚 Section 6

Is the parent-child relationship in coroutines always consistent? We have prepared various topics, from life cycle management through practical patterns to how to break the consistency of parent-child relationships in coroutines.

📚 Section 7

You will start learning about Flow. In this section, rather than just covering the theoretical part, you will learn by actually creating code, functions, or services that can be used in practice. This lecture covers asynchronous streams with reference to the largest practical example.

print ( "⚠️ Important points that Unicorn startup developers think about!! ⚠️" ) I think this is a must-have topic for working on big data streams for DB or processing general log data. There are some parts where the example code suddenly becomes difficult, but we prepared it so that you can handle it more enjoyably. If you chew on it and understand it and learn it, it will be of great help!

📚 Section 8

How do you communicate between coroutines? In concurrent programming, when you need to transfer data between systems that operate in parallel, or additionally transfer and process event-based data, or create a resource that shares data between lightweight threads!! You will learn about Channels that can handle various cases like these.

print ( "⚠️ Important points from a server developer who films lectures and develops platforms in Pangyo ⚠️" ) The act of guaranteeing data transfer between lightweight threads atomicly is very widely used. I hope that you will have time to implement channels in Kotlin in the same way as in Golang and manage data sharing resources in parallel programming together and get more immersed in coroutines.

📚 Section 9

How important is exception handling in Kotlin? It is a must-have item to prevent OOM caused by resource leaks. In this section, we will dive deeper into exception handling and prepare to create a more robust system!

📚 Section 10

The most important part of concurrent programming is control over shared resources. If you ignore this part, it is easy to encounter really dangerous situations such as Race Condition and Dead Lock. In this lesson, you will learn representative techniques to solve these problems.

print ( "⚠️ Important points that Toss developers think about ⚠️" ) When implementing functions for bank accounts and withdrawal services, access control to these shared resources is a very important topic. In this lecture, I personally consider this to be the most important topic, and even if it is not a coroutine, it is necessary to introduce, consider, and use this topic in general programming. As this is the last section, I think it is a very important topic, so I hope you will focus and learn it well.

Kotlin Masterclass through Time Capsule Project Practice

  • This is a Kotlin master class lecture that builds web services using Ktor, JetBrains' largest open source. Through this lecture, you will learn about Kotlin's basic grammar and practical encryption methods.

Kotlin Master Class: Learning through Bank Server Project Practice

  • You can learn everything about data processing methods, DB considerations, and how to utilize event-based data according to traffic type, using polyglot persistence strategies and Kafka, etc.

Things to note before taking the class

Practice environment

  • Taken using MacOS M3.


  • java --version : 17.0.12 2024-07-16 LTS

  • I use an IDE from the JetBrains family.

  • Build using Gradle.

  • It doesn't cover infrastructure.

Recommended for
these people

Who is this course right for?

  • Someone who wants to learn the coroutine concept properly

  • Learn Coroutines via practical examples

  • Those wanting to design/debug complex coroutine structures

  • Those interested in performance optimization and parallel processing

  • Kotlin-based backend and mobile developer

  • Backend/Mobile Developer interested in Kotlin on Spring

Hello
This is

2,732

Learners

188

Reviews

76

Answers

4.5

Rating

14

Courses

자기 소개

집에서 빈둥대다 개발에 흥미를 느껴 개발 공부를 시작하였고 현재는 판교에서 플랫폼 서버 개발을 담당하여 진행하고 있습니다.

 

제가 공부를 했던 방법과 실무에서 접하실 수 있는 여러가지 문제점들과 해결책을 여러분들에게 제공하고 싶어 지식공유자 활동을 이어나가고 있습니다.

 

강의는 오로지 저만의 지식을 통해 만들어지지 않습니다. 모든 강의는 함께하시는 분들이 계십니다.

 

지식공유자 경력

[前] 샌드박스 블록체인 개발자

[前] 넥슨 자회사 백엔드 개발자

[] 판교에서 고여가는 서버 개발자

 

인터뷰 이력

Curriculum

All

37 lectures ∙ (5hr 9min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

All

10 reviews

4.9

10 reviews

  • tttos님의 프로필 이미지
    tttos

    Reviews 6

    Average Rating 5.0

    5

    32% enrolled

    I am a developer at Toss, who participated in the lecture together and helped with the filming. While preparing this lecture, I thought about quite a lot. The topic of lightweight threads is not an easy one, and I also considered how to approach it. However, following the opinion of the person filming the lecture, I proceeded with the goal of providing as many diverse examples as possible and making the lecture more familiar rather than tightly structured. While it's a method with disadvantages, I also believe it has advantages. This lecture cannot make you a person who uses coroutines perfectly. This is only a lecture after all. Based on this lecture, if you try using it in various ways in practice, I believe you can become someone who uses coroutines perfectly. If this lecture doesn't satisfy you, please provide feedback as I have a strong willingness to learn and improve based on what's lacking.

    • hoos983485067님의 프로필 이미지
      hoos983485067

      Reviews 9

      Average Rating 5.0

      5

      97% enrolled

      Want to learn Kotlin and also want to learn Coroutines?? I think studying while referring to this would be the best learning method. Thank you.

      • jhong
        Instructor

        Hello Hoos! Thank you so much for leaving such a great review!! I'll make sure to come back with even better lectures in the future!! Have a wonderful day!!

    • ureview229499님의 프로필 이미지
      ureview229499

      Reviews 7

      Average Rating 5.0

      5

      95% enrolled

      I enjoyed watching various topics in an interesting way. It was very helpful. Thank you.

      • jhong
        Instructor

        Hello, "I want to be good at development"! Thank you so much for leaving such a Kind review!! I'll make sure to come back with even better lectures in the future!! Have a great day!!

    • sionicdan님의 프로필 이미지
      sionicdan

      Reviews 4

      Average Rating 5.0

      5

      62% enrolled

      • jhong
        Instructor

        Hello Choi Byunghyun, thanks for the review. I'll bring you better lectures going forward! Have a good day!

    • de님의 프로필 이미지
      de

      Reviews 9

      Average Rating 5.0

      5

      32% enrolled

      I am enjoying listening. It's still early, but it's quite a useful lecture.

      • jhong
        Instructor

        Hello devHand, thank you for your review! I'll come back with better lectures in the future!

    $53.90

    Hong's other courses

    Check out other courses by the instructor!

    Similar courses

    Explore other courses in the same field!