Sam Cooper
@sam-cooper.bsky.social
๐ค 342
๐ฅ 1701
๐ 142
Author of Kotlin Coroutine Confidence
https://pragprog.com/titles/sckotlin
pinned post!
New book! ๐ Kotlin Brain Teasers is out now in early access beta. If you like
#Kotlin
and enjoy yelling "Wait, WHAT?!" at your IDE, this is the book for you. Reviewers said: "I hate this code so much" and "This code is actively making my day worse." ๐ง ๐งฉ
pragprog.com/titles/kotli...
loading . . .
Kotlin Brain Teasers
Level up your Kotlin the fun way! Solve mysteries, dodge traps, and banish bugs. Sharpen your critical thinking to ace interviews and ship rock-solid code.
https://pragprog.com/titles/kotlinbt/kotlin-brain-teasers/
4 months ago
1
16
4
Where should I keep these? Feels wrong to just stash them in the bookshelf with the other tech stuff. On the other hand, leaving them out on the coffee table feels a bit like braggingโฆ
about 8 hours ago
0
0
0
Once again grinning proudly with a book in my hand! This is my second book, Kotlin Brain Teasers. It was so much fun to unbox this and see the code puzzles on paper. I hope you enjoy solving them! More about the book here ๐
pragprog.com/titles/...
1 day ago
0
4
1
reposted by
Sam Cooper
Gareth L. Powell
3 days ago
Just a reminder that if you enjoy a book, please leave a quick review on Amazon or Bookshop dot org, or wherever. Even if it's only a sentence, it really, really helps get the word out to other readers.
8
414
147
"The first tech book I could not put down. It is brilliantly structured, effortlessly engaging, and full of moments that make complex ideas click." Well, who am I to disagree? It's right there IN PRINT on the cover of my book! Don't just judge a book by its cover, though; buy it and make sure ๐
3 days ago
0
4
0
Why yes ๐ค what a very good book filled with practical coroutine advice ๐ง๐ก Still can't believe I'm holding a copy of my own book!
3 days ago
0
5
0
๐ด๐ต If you follow this #Kotlin tip from Seb you can actually make your regular functions blue and your #async functions red, just like in Bob Nystrom's "What color is your function?" ๐
http://youtu.be/L-37...
loading . . .
Custom colors for suspending functions in Kotlin coroutines #kotlin #programming
Kotlin coroutines are great, and its core primitive is the suspending function. With a small change in your IDE settings, you can give them a custom color (light a bright green), which makes it easy to spot them at a glance, even when you're looking at a lot of code.
http://youtu.be/L-37yVmXO1w
4 days ago
1
1
0
This silly pyramid sketch is one of my favourite illustrations I drew for my book. So cool to see it in print, it looks even better! This is a page from the second chapter of Kotlin Coroutine Confidence ๐
pragprog.com/titles/...
5 days ago
0
3
0
I will also post this picture on its own because I feel like I (accidentally) let the box take centre stage in my other post. The box is cool and all, but I MADE A BOOK! I think that means I have to proudly celebrate my achievement and not hide behind a box. ๐
pragprog.com/titles/...
5 days ago
0
3
0
This is the face of a proud author ๐. Just opened up my very own print copies of Kotlin Coroutine Confidence! It feels great to hold it in my hand after all that time spent staring at a manuscript on a screen.
6 days ago
1
7
0
reposted by
Sam Cooper
The Pragmatic Bookshelf โ
7 days ago
It's #FlashSale Weekend at
pragprog.com
#FlashSale
45% off* with code FlashSale *almost everything! During checkout, where to enter the code?
loading . . .
0
2
1
Channel: messages are shared out so that each message is received by exactly one consumer. Shared flow: messages are replicated so that each consumer receives its own copy of every message. #kotlin #coroutine tips ๐ก The diagram is from ๐ Kotlin Coroutine Confidence ๐
pragprog.com/titles/...
8 days ago
0
5
1
More time to get money off my books! ๐
add a skeleton here at some point
8 days ago
0
1
1
๐ก
#Kotlin
#coroutine
tip: a channel itself isn't a resource that needs closing. Its close() and cancel() functions are there to help you shut down the tasks/resources that are using or passing through the channel. Read more in Chapter 12 of Kotlin Coroutine Confidence ๐
loading . . .
Kotlin Coroutine Confidence
Escape callback hell and ship fast, clean code that reads as smoothly as it runs. Squash bugs and stamp out memory leaks with an intuitive concurrency toolkit.
https://pragprog.com/titles/sckotlin/kotlin-coroutine-confidence/
8 days ago
0
0
0
It's not just my Kotlin books that are on sale right nowโalmost everything in the Pragmatic Bookshelf lineup is still 45% off until tomorrow! ๐ What tech skill will you learn next? Use code "flashsale" to grab your discount and start reading right now. ๐๐
https://pragprog.com/
9 days ago
0
0
0
Here's another table that I included in ๐ Kotlin Coroutine Confidence. A Flow in Kotlin is often described as an asynchronous stream, but I prefer to think of it as a suspending function that returns multiple values. What do you think? Is it more helpful to think of it as a stream or a function?
10 days ago
1
1
0
โค๏ธ๐ Like or share if you know someone who'd like to save $ and learn a new tech skill! Almost everything in the Pragmatic Bookshelf lineup is 45% off right now when you use code "flashsale". There are some really unique titlesโI'd love to hear which book you choose! ๐๐
https://pragprog.com/
10 days ago
0
0
0
๐โฑ๏ธ Been waiting for the perfect time to buy my books? It's NOW! For the next 48 hours only (September 18โ20) you can use code "flashsale" to get 45% off all titles including Kotlin Coroutine Confidence and Kotlin Brain Teasers from The Pragmatic Bookshelf ๐๐
https://pragprog.com/
10 days ago
0
1
1
Just got a message from DHL that TWO shipments are coming from my publisher next week. Looks like I'll finally get my hands on some copies of my books!
10 days ago
0
2
0
reposted by
Sam Cooper
The Pragmatic Bookshelf โ
10 days ago
48 hour FLASH! 45% off with code FLASHSALE @pragdave felt like stirring things up - he just put nearly every title on sale!
loading . . .
2
10
14
Pros and cons of blocked threads, callbacks, and suspending functions. Can you think of any others? Which ones are most important in your day to day code? This table's from Chapter 2 of my book, Kotlin Coroutine Confidenceโfind it here ๐
pragprog.com/titles/...
11 days ago
0
1
0
Good diagrams can really help new concepts to click, so I made sure to illustrate ๐ Kotlin Coroutine Confidence with a whole bunch of them! This one is from Chapter 12, "Share Flows, Connect Channels." Want the text to go with it? Look for the free PDF excerpt here ๐
pragprog.com/titles/...
12 days ago
1
1
0
Tip to tell suspending functions and coroutines apart in Kotlin: ๐ก๐ Think of a suspending function as the script for a play, and a coroutine as the performance. ๐ญ Every chapter in my book ๐ Kotlin Coroutine Confidence ends with a "Key Concepts" recap to help you remember what you've learned ๐
13 days ago
1
3
0
Thread-safe sets in Kotlin? I used to use Collections.newSetFromMap(ConcurrentHashMap()), but recently I learned that Java 8 actually added the even more succinct ConcurrentHashMap.newKeySet(). Which is great, but now what do I do in multiplatform Kotlin code that can't use Java? ๐ค
13 days ago
2
3
0
reposted by
Sam Cooper
Shannon Hale
14 days ago
When you read a book and love it and then take the time to post a review online, it means SO MUCH to the writers. Thank you.
2
346
36
reposted by
Sam Cooper
Emil Privรฉr
14 days ago
I love programming
0
8
1
"Once upon a time, in a world vastly different than our own, a boy was born with antlers and horns and tail and more but that is beside the point his name was Paul. That's all." ๐๐
samwho.dev/story/?id=25...
loading . . .
Six Word Story
Collaborative internet storytelling, six words at a time.
https://samwho.dev/story/?id=253391
14 days ago
2
2
0
Blown away by Guy Steele's 1998 talk on "Growing a Language". Every single word he speaks is chosen with thoughtfulness and intentionโwhich turns out to be a metaphor for how to design a programming language that will stand the test of time. Well worth a watch!
loading . . .
OOPSLA Conference: Growing a Language
[Recorded on October 1998] From University Video Communications' catalog: "Over the last quarter-century Guy Steele has been convinced that trying to design a complete and perfect programming language is the worst thing you can do. A programming language (including its associated libraries) must g
https://www.youtube.com/watch?v=lw6TaiXzHAE
14 days ago
1
0
0
In all ways but one, Kotlin's 'suspend' keyword is exactly the same as async/await in other language. Kotlin just tries to improve safety and readability by combining the 'async' and 'await' operations together. Instead of using 'await' to opt in to waiting, you use 'launch' to opt out of waiting.
14 days ago
2
2
0
I had fun coming up with a few jokes and puns for ๐ Kotlin Coroutine Confidence. There are even some hidden easter eggs! Chapter 6 teaches you coroutine cancellation and has at least three references to a specific video game ๐ฎ. One is very well hidden, if you're looking for a challengeโฆ ๐
15 days ago
0
3
0
One of the fun parts of writing ๐ Kotlin Coroutine Confidence was finding sites and APIs for you to download data in all the hands-on asynchronous coding examples. In Chapter 6 we get highbrow with a tour of New York's Metropolitan Museum of Art! ๐ผ๏ธ Very cool that they have a free public API.
16 days ago
0
6
0
"Gigantic jet lightning" near the TexasโMexico border, photographed from the ISS by Nichole Ayers ๐คฏ You'll see tons more stunning photos like this when you connect to the NASA photo API in Chapter 2 of ๐ Kotlin Coroutine Confidence ๐โจ๐ฐ๏ธ ๐ Grab it at any bookstore, or
lnkd.in/eGAyGMRR
17 days ago
1
1
0
I verified my second book with the folks at
@medium.com
(thank you!) so my profile page now lists two titles! Looks very professional, I like it ๐ ๐
sam-cooper.medium.com/books
18 days ago
0
2
0
Breaking news: number goes up a bit Follow for more updates (it's gripping stuff)
18 days ago
0
1
0
Print copies of Kotlin Coroutine Confidence ๐ are starting to ship TODAY! If you've read it already, now is the time to leave a star rating on Amazon, Goodreads, etcโit really helps me out โค๏ธ โญ๏ธโญ๏ธโญ๏ธโญ๏ธโญ๏ธ
27 days ago
0
2
0
reposted by
Sam Cooper
about 2 months ago
I'm reading
@sam-cooper.bsky.social
's "Kotlin Coroutine Confidence". It's a masterpiece๐ซ, even if you already know
#Kotlin
coroutine machinery: It's worth your money ๐ฐ:
pragprog.com/titles/sckot...
2
4
2
Print version now available for preorder! ๐ It's the perfect gift for the Kotlin lover in your life. Use this link if you're in the US, or search on your favourite site. Don't forget to support your local bookstores! ๐
bookshop.org/a/2696//9798...
loading . . .
Kotlin Brain Teasers: Exercise Your Mind
Exercise Your Mind
https://bookshop.org/a/2696//9798888651582
3 months ago
0
0
0
Just added two new puzzles to ๐ Kotlin Brain Teasers! Take a look:
pragprog.com/titles/kotli...
loading . . .
Kotlin Brain Teasers
Level up your Kotlin the fun way! Solve mysteries, dodge traps, and banish bugs. Sharpen your critical thinking to ace interviews and ship rock-solid code.
https://pragprog.com/titles/kotlinbt/kotlin-brain-teasers/
3 months ago
0
2
0
Just released the Beta 2.0 update for Kotlin Brain Teasers, with three new puzzles! You can find out more, leave your feedback, and grab your DISCOUNT code on the DevTalk forum, linked below. Tell me what you think of the new puzzles!
forum.devtalk.com/t/kotlin-bra...
loading . . .
Kotlin Brain Teasers (PragProg)
Level up your Kotlin the fun way! Solve mysteries, dodge traps, and banish bugs. Sharpen your critical thinking to ace interviews and ship rock-solid code. Sam Cooper @sam-cooper edited by Dawn ...
https://forum.devtalk.com/t/kotlin-brain-teasers-pragprog/201086
4 months ago
0
5
1
reposted by
Sam Cooper
The Pragmatic Bookshelf โ
4 months ago
New in BETA - by Sam Cooper Level up the fun way!
pragprog.com/titles/...
Prepare for interviews, tests, competitions, real-world projects, and more with powered-up problem-solving proficiency, improved coding confidence, and lasting
#Kotlin
lessons. Most of all, have fun!
2
7
3
๐ก๐ฌ "When judging the relative merits of #programming languages, some still seem to equate the ease of programming with the ease of making undetected mistakes." Written by Dijkstra in 1979; still true in 2025 ๐. Don't use JavaScript, people!
www.cs.utexas.edu/~E...
4 months ago
0
2
1
I'm rating my new
#Kotlin
Brain Teasers book using AIโif an LLM can solve it, it's a boring puzzle. Things are looking good for puzzle 1: "In Kotlin, if you try to write println(null + null) you will get a compile-time error." Wrong! Can you guess what really happens?
pragprog.com/titles/kotli...
4 months ago
0
3
0
New book! ๐ Kotlin Brain Teasers is out now in early access beta. If you like
#Kotlin
and enjoy yelling "Wait, WHAT?!" at your IDE, this is the book for you. Reviewers said: "I hate this code so much" and "This code is actively making my day worse." ๐ง ๐งฉ
pragprog.com/titles/kotli...
loading . . .
Kotlin Brain Teasers
Level up your Kotlin the fun way! Solve mysteries, dodge traps, and banish bugs. Sharpen your critical thinking to ace interviews and ship rock-solid code.
https://pragprog.com/titles/kotlinbt/kotlin-brain-teasers/
4 months ago
1
16
4
Got my โ Verified Author icon on Medium! Very proud to be able to showcase my upcoming book alongside all my other writing. โ๏ธ My Medium page:
sam-cooper.medium.com
5 months ago
0
2
0
Leaked coroutine context and cascading cancellation ๐ฌ๐ฅ. Here's a story about a couple of nasty bugs I ran into when adapting a Caffeine AsyncCache for use with
#Kotlin
#coroutines
. Hope it can help others avoid the same issues in future!
sam-cooper.medium.com/0b6e9fecad11
loading . . .
Does Your Kotlin Async Cache Leak User Data Between Coroutines?
Donโt let shared computations turn into shared errors and cancellations
https://sam-cooper.medium.com/0b6e9fecad11
5 months ago
1
4
0
Me doing an interactive rebase:
youtu.be/d9tcEAhQTR8...
loading . . .
How I met Your Mother - Gonna Resolve Some Conflicts!
From HIMYM S9E8. Disclaimer "No copyright is claimed in How I Met Your Mother - S9E8 and to the extent that material may appear to be infringed, I assert that such alleged infringement is permissible under fair use principles in U.S. copyright laws. If you believe material has been used in an unaut
https://youtu.be/d9tcEAhQTR8?t=15
5 months ago
0
1
0
Huge news if you're in the USA: you can preorder a print copy of my book RIGHT NOW!
bookshop.org/a/2696/...
5 months ago
1
1
0
One of the places I learned most about #coroutines in #Kotlin was reading the source code for the sequence() builderโwhich isn't part of the coroutines library at all. Turns out asynchronous programming is just one of many ways to use the suspend keyword!
sam-cooper.medium.co...
loading . . .
Suspending Kotlin Beyond Coroutines
Get creative with continuations for recursion, serialization, sequences, and more
https://sam-cooper.medium.com/suspending-kotlin-beyond-coroutines-4c97543b9782
5 months ago
0
1
1
Cancellation is a huge part of how #Kotlin #coroutines keep your concurrent code safe and fast. Most of the time it just works, but when it doesn't, you need to know how to fix it. Here's my guide:
sam-cooper.medium.co...
#Kotlin
#coroutines
#concurrency
#codingtips
loading . . .
Kotlin Coroutine Cancellation, Explained
Safely stop suspending tasks for faster apps and fewer bugs
https://sam-cooper.medium.com/kotlin-coroutine-cancellation-explained-6a545c8da252
5 months ago
0
6
0
Higher-order functions have to pick whether to be async or non-asyncโit's one of the major problems described in "What Color is Your Function" (๐ link in comments). So I totally understand why Simon loves this
#Kotlin
#coroutines
solution using 'inline'!
nomisrev.github.io/inline-and-s...
loading . . .
My favorite Kotlin feature
Over the last several years Iโve seen many discussions on Kotlinโs features. Nullability is always a very high ranked one. I like it, but itโs definitely not my favorite feature.
https://nomisrev.github.io/inline-and-suspend/
6 months ago
2
4
0
Unlike other languages, #Kotlin makes you opt in explicitly when you want your #coroutines served with a side order of multitasking. Good choice or bad? #async #codingtips This tip is from Chapter 4 of ๐ Kotlin Coroutine Confidence. Get the Beta now! ๐
pragprog.com/titles/...
6 months ago
1
2
0
Load more
feeds!
log in