The document introduces coroutines in Kotlin. It discusses how coroutines make asynchronous code easier to write by allowing suspending functions and avoiding callback hell. Coroutines were introduced in early languages like Simula but fell out of favor due to multithreading. They are now regaining popularity for writing asynchronous non-blocking code. The document then covers how coroutines work in Kotlin, including suspending functions, coroutine builders like launch and async, and how coroutines avoid issues with approaches like callbacks and futures. It notes that coroutines in Kotlin are currently experimental but can be used in production code.
Improving app performance with Kotlin CoroutinesHassan Abid
Coroutines were added to Kotlin in version 1.3 and since then they became a popular choice for android developers to simplify code that executes asynchronously. Coroutines are lightweight threads and on android they help to solve the primary problems of long running tasks that might block the main thread and also providing safety for offloading network or disk operations from the main thread. This talk covers how coroutines work with architecture components
Kotlin Coroutines and Android sitting in a treeKai Koenig
Since the release of Kotlin 1.1 there is now the new language feature of Kotlin Coroutines available for use in Java and Android projects. Coroutines are a new way to write asynchronous and non-blocking code. They can be thought of as light-weight threads without having to deal with all the problems that threads bring to the table.
A lot of developers think that Kotlin Coroutines are mainly or only useful for Kotlin on the JVM, but that’s not true. There are a variety of use cases in which the application of Coroutines can make a lot of sense on Android.
This talk is introducing the ideas behind Kotlin Coroutines, showing how to use them in Kotlin code for both the JVM and Android via the kotlinx-coroutines APIs and then exploring specific applications in Android. Part of this is a deeper look into the use of Coroutines in higher-level frameworks such as AsyncAwait and Anko.
Improving app performance with Kotlin CoroutinesHassan Abid
Coroutines were added to Kotlin in version 1.3 and since then they became a popular choice for android developers to simplify code that executes asynchronously. Coroutines are lightweight threads and on android they help to solve the primary problems of long running tasks that might block the main thread and also providing safety for offloading network or disk operations from the main thread. This talk covers how coroutines work with architecture components
Kotlin Coroutines and Android sitting in a treeKai Koenig
Since the release of Kotlin 1.1 there is now the new language feature of Kotlin Coroutines available for use in Java and Android projects. Coroutines are a new way to write asynchronous and non-blocking code. They can be thought of as light-weight threads without having to deal with all the problems that threads bring to the table.
A lot of developers think that Kotlin Coroutines are mainly or only useful for Kotlin on the JVM, but that’s not true. There are a variety of use cases in which the application of Coroutines can make a lot of sense on Android.
This talk is introducing the ideas behind Kotlin Coroutines, showing how to use them in Kotlin code for both the JVM and Android via the kotlinx-coroutines APIs and then exploring specific applications in Android. Part of this is a deeper look into the use of Coroutines in higher-level frameworks such as AsyncAwait and Anko.
This is an introduction to Kotlin Coroutines and How we can use it in Android. I have tried cover all the basic stuff of coroutine and also added a comparison of thread and coroutine. Github sample project link: https://github.com/bipinvaylu/kotlin-coroutines
Slides with speaker contents: https://docs.google.com/presentation/d/1Wn9ImL9meON2Ohg7pPVYCXKNezilJyX6ewDWU3ljrwE/edit?usp=sharing
Jetpack Compose - Android’s modern toolkit for building native UIGilang Ramadhan
Jetpack Compose simplifies and accelerates UI development on Android. Quickly bring your app to life with less code, powerful tools, and intuitive Kotlin APIs.
Asynchronous JavaScript Programming with Callbacks & PromisesHùng Nguyễn Huy
This presentation is about JavaScript Promise. Topics covered in this session are:
1. Asynchronous processing in JavaScript
2. Callbacks and Callback hell
3. Promises arrive in JavaScript!
4. Constructing a Promise
5. Promise states
6. Promises chaining and transformation
7. Error handling
8. Promise.all() and Promise.race()
As a part of kotlinx.coroutines 1.2 Flow was introduced as a cold asynchronous data stream. How does it work? What we can do with it? Is it that we waiting so long for replacing Rx? The talk has answers to them.
Google is adding Kotlin as an official programming language for Android development. Kotlin is a language that runs on the JVM and has full interoperability with Java. It costs nothing to adopt! I will show some cool features of Kotlin, how it makes developing with Android easy and finally we'll see what happens under the hood when we write in Kotlin.
All 3 Clean Code presentations provide great value by themselves, but taken together are designed to offer a holistic approach to successful software creation. This first session creates the foundation for the 2nd and 3rd Clean Code presentation on Dependency Injection, as it explains expected base knowledge. Why writing Clean Code makes us more efficient Over the lifetime of a product, maintaining the product is actually one - if not the most - expensive area(s) of the overall product costs.
We will dive into the basics of Inversion of Control (IOC) and Dependency Injection (DI) to review different ways of achieving decoupling, using and exploring both: Best Practices, Design and Anti Patterns. This presentation requires knowledge and understanding of basics like DRY, SoC, SRP, SOLID etc. which are building the base for decoupled architecture. However, we will start at the basics of DI and will work towards intermediate and advanced scenarios depending on the participating group.
This presentation is based on C# and Visual Studio 2013. However, the demonstrated patterns and practice can be applied to every other programming language too.
Note: Moving forwards this presentation will be updated with the latest version of the slides for the last event I did the presentation instead of creating new separate slide decks here on SlideShare.
Presentation dates and locations:
2015-10-03 Silicon Valley Code Camp, San Jose, CA
2015-06-27 SoCal Code Camp - San Diego, CA
2015-06-25 Bay.NET South Bay, Mountain View, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-11 Silicon Valley Code Camp, Los Altos Hills, CA
In this tutorial on What are Coroutines in Kotlin, you will learn the basics of threads and understand how coroutines work in Kotlin. You'll look at the different features and examples of coroutines. Finally, you'll see a demo of Kotlin Coroutines.
Utilizing Kotlin Flows in an Android application
Vijay will be revealing to you the kind of challenges we face while working with asynchronous data streams and how Kotlin Flows solves them.
Learn the latest tips, tricks, and tools for Android Development from our international team of Android Developers in Bangkok!
JavaScript has some stunning features like Closures, Prototype etc. which can help to improve the readability and maintainability of the code. However, it is not easy for inexperienced developer to consume and apply those features in day to day coding. The purpose of the presentation ‘Advanced JavaScript’ is to help a reader easily understand the concept and implementation of some advanced JavaScript features.
Scratching the itch, making Scratch for the Raspberry PieESUG
Title: Scratching the itch, making Scratch for the Raspberry Pie
Speaker: Tim Rowledge
Fri, August 22, 12:00pm – 12:30pm
Abstract: Scratch was originally written in a Squeak 2.8 era image. Much has changed since then and to make the Raspberry Pi run Scratch as well as possible we have ported the code forward to a 4.5 image so it can run on a StackVM; and soon a Cog VM. A substantial amount of Smalltalk code has had to be rewritten to do this and yet we have to maintain complete compatibility with the original system to avoid overloading the teachers that use it in their classes. A new branch of Cog for the ARM cpu is being written as well.
Bio: Tim Rowledge has almost 30 years of Smalltalk experience, and almost as much with ARM. Somehow the two have always gone together.
This is an introduction to Kotlin Coroutines and How we can use it in Android. I have tried cover all the basic stuff of coroutine and also added a comparison of thread and coroutine. Github sample project link: https://github.com/bipinvaylu/kotlin-coroutines
Slides with speaker contents: https://docs.google.com/presentation/d/1Wn9ImL9meON2Ohg7pPVYCXKNezilJyX6ewDWU3ljrwE/edit?usp=sharing
Jetpack Compose - Android’s modern toolkit for building native UIGilang Ramadhan
Jetpack Compose simplifies and accelerates UI development on Android. Quickly bring your app to life with less code, powerful tools, and intuitive Kotlin APIs.
Asynchronous JavaScript Programming with Callbacks & PromisesHùng Nguyễn Huy
This presentation is about JavaScript Promise. Topics covered in this session are:
1. Asynchronous processing in JavaScript
2. Callbacks and Callback hell
3. Promises arrive in JavaScript!
4. Constructing a Promise
5. Promise states
6. Promises chaining and transformation
7. Error handling
8. Promise.all() and Promise.race()
As a part of kotlinx.coroutines 1.2 Flow was introduced as a cold asynchronous data stream. How does it work? What we can do with it? Is it that we waiting so long for replacing Rx? The talk has answers to them.
Google is adding Kotlin as an official programming language for Android development. Kotlin is a language that runs on the JVM and has full interoperability with Java. It costs nothing to adopt! I will show some cool features of Kotlin, how it makes developing with Android easy and finally we'll see what happens under the hood when we write in Kotlin.
All 3 Clean Code presentations provide great value by themselves, but taken together are designed to offer a holistic approach to successful software creation. This first session creates the foundation for the 2nd and 3rd Clean Code presentation on Dependency Injection, as it explains expected base knowledge. Why writing Clean Code makes us more efficient Over the lifetime of a product, maintaining the product is actually one - if not the most - expensive area(s) of the overall product costs.
We will dive into the basics of Inversion of Control (IOC) and Dependency Injection (DI) to review different ways of achieving decoupling, using and exploring both: Best Practices, Design and Anti Patterns. This presentation requires knowledge and understanding of basics like DRY, SoC, SRP, SOLID etc. which are building the base for decoupled architecture. However, we will start at the basics of DI and will work towards intermediate and advanced scenarios depending on the participating group.
This presentation is based on C# and Visual Studio 2013. However, the demonstrated patterns and practice can be applied to every other programming language too.
Note: Moving forwards this presentation will be updated with the latest version of the slides for the last event I did the presentation instead of creating new separate slide decks here on SlideShare.
Presentation dates and locations:
2015-10-03 Silicon Valley Code Camp, San Jose, CA
2015-06-27 SoCal Code Camp - San Diego, CA
2015-06-25 Bay.NET South Bay, Mountain View, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-11 Silicon Valley Code Camp, Los Altos Hills, CA
In this tutorial on What are Coroutines in Kotlin, you will learn the basics of threads and understand how coroutines work in Kotlin. You'll look at the different features and examples of coroutines. Finally, you'll see a demo of Kotlin Coroutines.
Utilizing Kotlin Flows in an Android application
Vijay will be revealing to you the kind of challenges we face while working with asynchronous data streams and how Kotlin Flows solves them.
Learn the latest tips, tricks, and tools for Android Development from our international team of Android Developers in Bangkok!
JavaScript has some stunning features like Closures, Prototype etc. which can help to improve the readability and maintainability of the code. However, it is not easy for inexperienced developer to consume and apply those features in day to day coding. The purpose of the presentation ‘Advanced JavaScript’ is to help a reader easily understand the concept and implementation of some advanced JavaScript features.
Scratching the itch, making Scratch for the Raspberry PieESUG
Title: Scratching the itch, making Scratch for the Raspberry Pie
Speaker: Tim Rowledge
Fri, August 22, 12:00pm – 12:30pm
Abstract: Scratch was originally written in a Squeak 2.8 era image. Much has changed since then and to make the Raspberry Pi run Scratch as well as possible we have ported the code forward to a 4.5 image so it can run on a StackVM; and soon a Cog VM. A substantial amount of Smalltalk code has had to be rewritten to do this and yet we have to maintain complete compatibility with the original system to avoid overloading the teachers that use it in their classes. A new branch of Cog for the ARM cpu is being written as well.
Bio: Tim Rowledge has almost 30 years of Smalltalk experience, and almost as much with ARM. Somehow the two have always gone together.
Isomorphism: the Holy Grail of code reuse. Is Kotlin up to the task? What do we even mean when we say isomorphism? We walk through the current state of the art with Kotlin, showcasing Kotlin's capabilities to run on targets such as iOS, Android, Web, and Server platforms. As well, we'll cover other approaches and platforms that promise similar code reuse. We'll take a detour and look at Kotlin/Native, comparing and contrasting it's approach. Along the way, we'll also explore some application architectures that make the most of shared code modules. In the end, we make an informed decision: is isomorphic Kotlin wired or tired?
Future of Kotlin - How agile can language development be?Andrey Breslav
A successful project usually grows, and Kotlin is no exception. We are adding new targets (JavaScript and Native) and new computation models (coroutines). This talk is about our vision of the future of Kotlin as a language and a ecosystem.
We'll talk strategy: what we think our industry needs at large and how we are going to fit Kotlin into this picture. We'll talk tactics: how we deal with legacy and compatibility issues, and whether there will ever be Kotlin 2.0. We'll talk operations: can we do “continuous delivery” for language features? Or, more generally, how agile can language development be?
https://mixitconf.org/en/2017/the-future-of-kotlin-how-agile-can-language-development-be-
Eclipse OMR: a modern, open-source toolkit for building language runtimesDev_Events
Daryl Maier, Compiler Development Performance, IBM
Cloud, @0xdaryl
Java runtime technology has benefited from hundreds
of person years of development investment over the
last 20 years, resulting in a highly capable, high
performance and scalable dynamic language with a
vibrant developer ecosystem. The recently created OMR incubator project at Eclipse
(https://github.com/eclipse/omr) aims to expand access to high quality runtime technology for other
dynamic languages through an ongoing effort to restructure the core components of the J9 Java Virtual
Machine. Rather than building new languages on top of Java, however, this project aims to unlock the
inner workings of the JVM without imposing Java semantics to create a platform for building highly
capable language runtimes. This talk will introduce developers to the Eclipse OMR project: what it is, the
runtime technology that has been contributed so far, promising projects that leverage this technology,
active areas of development, and how developers can get involved.
A talk describing our experiences building monorepo at Pinterest.
This talk was presented at Mobile Summit'18 held at CapitalOne in SF on May 22, 2018.
Go - A Key Language in Enterprise Application Development?C4Media
Video and slides synchronized, mp3 and slide download available at URL https://bit.ly/2COBbRN.
Aarti Parikh goes over the Go language design and talks about why Go matters in the age of multicores and cloud-native computing. Filmed at qconsf.com.
Aarti Parikh is a software engineering manager with a decade of experience building teams and products for the Internet, IoT and now Fintech. Currently, she works at PayPal.
Scalable Game Servers talk I gave at TGC 2017
The slides describe the case for building distributed systems using a statteful architecture to achieve high throughput and low latency using Microsoft Orleans as the best provider and inventor of the virtual actor model.
http://github.com/dotnet/orleans
'Full Stack Kotlin' Workshop at KotlinConfGarth Gilmour
Slides from my workshop on 'Building a Full Stack Web App in Kotlin'. Note these are only talking points, the full set of materials is available at:
https://gitlab.com/instil-training/kotlinconf-workshop-2018
Lock-free algorithms for Kotlin CoroutinesRoman Elizarov
Presentation for SPTCC 2017 - http://neerc.ifmo.ru/sptcc/
Video (part 1): https://www.youtube.com/watch?v=W2dOOBN1OQI
Video (part 2): https://www.youtube.com/watch?v=iQsN_IDUTSc
This is a detailed review of ACM International Collegiate Programming Contest (ICPC) Northeastern European Regional Contest (NEERC) 2016 Problems. It includes a summary of problem and names of problem authors and detailed runs statistics for each problem.
Problem statements are available here:
http://neerc.ifmo.ru/information/problems.pdf
The beginning of the following video has the actual review (in Russian): https://www.youtube.com/watch?v=fN25KkNYsjA
Многопоточное Программирование - Теория и ПрактикаRoman Elizarov
Многоядерные процессоры используются во всех серверах, рабочих станциях и мобильных устройствах. Написание многопоточных программ необходимо для обеспечения вертикальной масштабируемости, но, в отличие от однопоточных программ, их намного сложней отладить и протестировать, чтобы убедиться в корректности. Важно понимать какие именно гарантии дают те или иные конструкции языка и библиотеки при их многопоточном исполнении и какие подводные камни могут нарушить корректность кода. Доклад будет содержать краткое введение в теорию многопоточного программирования. Мы рассмотрим теоретические модели, которые используются для описания поведения многопоточных программ. Будут рассмотрены понятия последовательной согласованности и линеаризуемости (с примерами) и объяснено зачем это все-нужно программисту-практику. Будет показано как эти понятия применяются в модели памяти Java с примерами кода приводящего к неожиданным результатам с точки зрения человека, который с ней не знаком.
Доклад сделан для конференции Java Point Student Day 2016.
Slides from tech talk about the art of non-blocking waiting in Java with LockSupport.park/unpark and AbstractQueuedSynchronizer. Presented on JPoint 2016 Conference.
This is a detailed review of ACM International Collegiate Programming Contest (ICPC) Northeastern European Regional Contest (NEERC) 2015 Problems. It includes a summary of problem and names of problem authors and detailed runs statistics for each problem. Video of the actual presentation that was recorded during NEERC is here https://www.youtube.com/watch?v=vn7v1MuWXdU (in Russian)
Note: there were only preliminary stats avaialble, because problems review was happening before before the closing ceremony. This published presentation has full stats.
Пишем самый быстрый хеш для кэширования данныхRoman Elizarov
Типичный случай — приложению работающему с БД некоторые объекты нужны так часто, то их необходимо кэшировать в памяти. В этом случае их кладут в структуру данных типа хэш. Однако, бывают случаи, когда даже поиск в этом хэше становится узким местом приложения и решения из стандартных библиотек перестают устраивать по своей производительности.
Основной упор доклада будет не на конкретный алгоритм, а на та техниках дизайна быстрых алгоритмов — на что надо обращать внимание, как вообще подходить к решению подобных задач.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
3. Disclaimer
• Most ideas presented herein are very old
• Simula ‘67 was one of the first languages to
introduce coroutines
• detach – was a coroutine suspension statement
• resume – was to resume coroutine execution
• CLU ‘75 was the first language with generators and
Icon ‘77 was prominently using them
• Coroutines fell out of favor due to emergence of
multithreading
• And now they are back to write asynchronous code
22. A digression on async/await
async function preparePost() {
let request = composeTokenRequest();
let result = await makeRequest(request);
return result.parseToken();
}
async function preparePost(): Promise<Token> {
let request = composeTokenRequest();
let result = await makeRequest(request);
return result.parseToken();
}
JS approach to the same
problem (also TS, C#, Dart, etc)
mark with async
use await to suspend
JS
29. Kotlin approach to async
async function doSomething(): Promise<Result> {
/* ... */
}
Sometimes you need the Promise and async
let request1 = doSomething();
let request2 = doSomething();
1
2
To start multiple operations
concurrently
await request1;
await request2;
JS
and then wait for them
async builder
await function
Returns Deferred<Result>
Suspends until deferred is complete
30. Recap
• Coroutine builders
• launch
• runBlocking
• async
• Suspending functions with suspend keyword
• Can nest to any depth
(not stackless)
• suspendCoroutine
Regular
world
Coroutine
Coroutine Callback
Coroutine Coroutine
32. Library vs language
• Kotlin language only has suspend keyword
• Transforms suspend functions to callbacks
• Compiles code to state machines
• stdlib has Continuation and CoroutineContext
• Everything else is in a library
• It includes launch/join, async/await, runBlocking, etc
• We were using kotlinx.coroutines library
• http://github.com/kotlin/kotlinx.coroutines
• You can study source and contribute
It is designed to be composable
Mix & match different libs
33. Experimental status of coroutines
• This design is new and unlike mainstream
• For some very good reasons
• We want community to try it for real
• So we released it as an experimental feature
• We guarantee backwards compatibility
• Old code compiled with coroutines continues to work
• We reserve the right to break forward compatibility
• We may add things so new code may not run w/old RT
• Design will be finalized at a later point
• Old code will continue to work via support library
• Migration aids to the final design will be provided
opt-in flag
35. There is more
• Channels/Actors
• Selection and synchronization
• Job hierarchies and cancellation
• buildSequence/yield
• Restricted (sync) suspension
• Interop with other futures/promise/reactive libs
• The actual implementation details
• Learn more in Guide to kotlinx.coroutines by example
• KotlinConf on 2-3 November, 2017 in SF