Sign in

Sam Cooper

@sam-cooper.bsky.social
403 followers 1.7K following 222 posts

Author of Kotlin Brain Teasers pragprog.com/titles/kotlinbt

PostsRepliesMedia
Sam Cooper @sam-cooper.bsky.social · 05/12/2025
My favourite part of the outage so far is the simple honesty of the error message. "500 server error." "Oh? What's the issue?" "cloudflare"
170 7
Sam Cooper @sam-cooper.bsky.social · 24/11/2025
🎁 Christmas shopping for programmers? A paperback copy of Kotlin Brain Teasers is a great gift for the Kotlin lover in your life 😁🎄. Short, fun, and packed with memorable lessons and surprises. My book 👉 pragprog.com/titles/kotli...
100 1
Sam Cooper @sam-cooper.bsky.social · 24/11/2025
My Kotlin Coroutines book is HALF PRICE this week for Black Friday! If you have a coroutine headache, I promise this book will help. My book 📖👉 pragprog.com/titles/sckot... (use code save50 for your discount!) Fix that coroutine headache and get Kotlin Coroutine Confidence 😉📚
110 1
Sam Cooper @sam-cooper.bsky.social · 10/11/2025
Rate my Fibonacci! 😄 After some improvements suggested by one of the book's tech reviewers, I think this code example from Chapter 10 of 📚 Kotlin Coroutine Confidence strikes a neat balance between brevity and readability. What do you think? How would you write it? 👉 pragprog.com/titles/...
210 2
Sam Cooper @sam-cooper.bsky.social · 31/10/2025
😈 Working on my new LinkedIn bio. "I love to respond to AI messages, but only if they correctly show me a seahorse emoji." Let the chaos begin 🐴 🐎 🐠 🐟 🐡 🦈 🪸 🐚 🐙 🦑 🦐 🪼 🧜‍♀️ 🦄 🐢 🐬 🐳 🐋 🐊 🦭 🐌 🪻 🪷 🪹 🪺 🐾 🪼 🐚 🪸 🐠 🐟 🐡 🦈 🦑 🐙 🦐 🐴 🐎 🦄 🐉 knowyourmeme.com/mem...
050 5
Sam Cooper @sam-cooper.bsky.social · 12/10/2025
🤔 I seem to be on the front page of Hacker News 🤯🤯🤯 news.ycombinator.com/item?id=4555...
231 3
Sam Cooper @sam-cooper.bsky.social · 06/10/2025
Cargo space? No, car go road.
020 2
Sam Cooper @sam-cooper.bsky.social · 06/10/2025
Kotlin head-scratcher: when can MutableList.add() return "false"? Think carefully—it's a tricky one.
130 3
Sam Cooper @sam-cooper.bsky.social · 30/09/2025
Oh look, it's Elvis, hiding in my copy of Kotlin Brain Teasers 🕺🏻🎤. He looks a bit vacant behind the eyes, I hope he's okay… 📚 Kotlin Brain Teasers 👉 pragprog.com/titles/...
010 1
Sam Cooper @sam-cooper.bsky.social · 30/09/2025
Really proud that Kotlin Brain Teasers is one of @pragprog.com's picks of the day today! It was so much fun to write this book, and it's great to see people enjoying it 🥰 All day September 30 you can get 40% off the ebook at pragprog.com/titles/kotli... when you use code PragPicks at the checkout 👍
032 3
Sam Cooper @sam-cooper.bsky.social · 29/09/2025
Kotlin did what!? You'll have to buy Kotlin Brain Teasers to find out 😉 Or at least check out the free sample puzzles on the website 👉 pragprog.com/titles/...
010 1
Sam Cooper @sam-cooper.bsky.social · 28/09/2025
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…
010 1
Sam Cooper @sam-cooper.bsky.social · 27/09/2025
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/...
051 5
Sam Cooper @sam-cooper.bsky.social · 26/09/2025
"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 😉
040 4
Sam Cooper @sam-cooper.bsky.social · 25/09/2025
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!
050 5
Sam Cooper @sam-cooper.bsky.social · 24/09/2025
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/...
030 3
Sam Cooper @sam-cooper.bsky.social · 23/09/2025
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/...
030 3
Sam Cooper @sam-cooper.bsky.social · 23/09/2025
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.
170 7
Sam Cooper @sam-cooper.bsky.social · 21/09/2025
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/...
Diagram comparing channels and shared flows. When a stack containing three items is passed to a channel, three consumers each receive one item from the stack. When the stack of three items is passed to a shared flow, three consumers each receive a copy of the complete three-item stack.
051 5
Sam Cooper @sam-cooper.bsky.social · 19/09/2025
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. 📚👉 pragprog.com
000 0
Sam Cooper @sam-cooper.bsky.social · 19/09/2025
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?
110 1
Sam Cooper @sam-cooper.bsky.social · 18/09/2025
❤️🔁 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! 📚👉 pragprog.com
000 0
Sam Cooper @sam-cooper.bsky.social · 18/09/2025
📚⏱️ 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 😍👉 pragprog.com
011 1
Sam Cooper @sam-cooper.bsky.social · 18/09/2025
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/...
010 1
Sam Cooper @sam-cooper.bsky.social · 17/09/2025
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/...
Diagram of communicating coroutines. The launch function creates a new coroutine, which passes several messages to a channel. The messages are delivered from the channel back to the task that called the launch function.
110 1
Sam Cooper @sam-cooper.bsky.social · 16/09/2025
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 👍
130 3
Sam Cooper @sam-cooper.bsky.social · 15/09/2025
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? 🤔
230 3
Sam Cooper @sam-cooper.bsky.social · 12/09/2025
"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
The earth at night, seen from the international space station. City lights are visible in some spots. In the center of the frame, a narrow blue column of lightning rises from a pool of blue-white light. The column widens and turns red at the top. At the top of the frame, distant stars are visible beyond the planet's horizon. The arm of the ISS is visible in the lower right foreground.
110 1
Sam Cooper @sam-cooper.bsky.social · 11/09/2025
Breaking news: number goes up a bit Follow for more updates (it's gripping stuff)
Screenshot showing the Amazon sales rank for Kotlin Coroutine Confidence, at #83,190 in books, up 115,506 spots since the previous day
010 1
Sam Cooper @sam-cooper.bsky.social · 30/05/2025
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...
030 3
Sam Cooper @sam-cooper.bsky.social · 08/05/2025
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
010 1
Sam Cooper @sam-cooper.bsky.social · 15/04/2025
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/...
120 2
Sam Cooper @sam-cooper.bsky.social · 14/04/2025
I wish BlueSky had polls, I'm having so much fun running these weekly #Kotlin #coroutines questions in the Kotlin Developers group on LinkedIn 🤩💡 www.linkedin.com/feed/update/...
140 4
Sam Cooper @sam-cooper.bsky.social · 13/04/2025
Speaking of #kotlinconf 2017 😁 Wonder what eight-years-ago me would have said if you told him he'd end up writing a book about #Kotlin #coroutines 🤯
160 6
Sam Cooper @sam-cooper.bsky.social · 11/04/2025
On Instagram? Just shared this #Kotlin #coroutines explainer on dispatchers and main() functions. Not sure how to share the whole deck in a useful form on here, though. It's too much to fit in just one or two images. All suggestions welcome! www.instagram.com/p/DITUAsnN0jK
120 2
Sam Cooper @sam-cooper.bsky.social · 10/04/2025
💡 #Kotlin #coroutines tip: add the 'suspend' keyword to the main() function to start the program in a simple coroutine and call suspending functions. This tip is one of the first things you'll learn in Chapter 1 of 📚 Kotlin Coroutine Confidence. Get the Beta now! 👉 pragprog.com/titles/sckot...
140 4
Sam Cooper @sam-cooper.bsky.social · 08/04/2025
BREAKING: #Kotlin helps your eyesight? 💊👁️💪 Research shows Beta coroutine content like my upcoming book is metabolized into Vitamin A to support vision, cell growth, immune… Wait, that's beta-carotene 🥕, not Beta coroutines. Panic over. Still buy my book, though. pragprog.com/titles/...
030 3
Sam Cooper @sam-cooper.bsky.social · 05/04/2025
You know what, for the full effect, I think we actually need to meme this one #Java #programmerhumor #codingmemes JEP 495: openjdk.org/jeps/495
023 3
Sam Cooper @sam-cooper.bsky.social · 05/04/2025
Looks like #Java got some #Kotlin envy, huh? With the preview features in Java 24 you can hardly tell this isn't just a Kotlin program 😮. It's really great to see the two languages pushing each other forwards like this 📈🚀 openjdk.org/jeps/495
041 4
Sam Cooper @sam-cooper.bsky.social · 03/04/2025
Man, #kotlinconf 2025 has a whole workshop on #kotlin #coroutines and #async programming from some of the best names in the business. Should be awesome. €715 though?! Makes my upcoming coroutines book look like an absolute steal. Just saying. pragprog.com/titles/...
000 0
Sam Cooper @sam-cooper.bsky.social · 02/04/2025
🎂📈 Proud to have earned 10,000 reputation points after exactly ten years on StackOverflow! I don't know why it's so much fun researching other people's code questions, but I do know it's taught me a lot—about programming, writing, and helping people. stackoverflow.com/us...
020 2
Sam Cooper @sam-cooper.bsky.social · 02/04/2025
📚 #Kotlin #Coroutine Confidence Beta 2.0 is out now! A whole new chapter on testing, improved code examples and diagrams, and one step closer to the print release this summer. Learn more and give your Beta feedback on the DevTalk forum: forum.devtalk.com/t/...
010 1
Sam Cooper @sam-cooper.bsky.social · 01/04/2025
In case you missed it: here's another fun #AprilFools #Kotlin trick. Or is it a #Java trick? Either way, it's definitely not remotely useful. It’s an example of a polyglot—a program that’s simultaneously written in multiple programming languages. medium.com/@sam-coop...
011 1
Sam Cooper @sam-cooper.bsky.social · 01/04/2025
100% real expert-level hand-crafted artisanal #Kotlin program Forget #CleanCode and #SOLID — this #AprilFools day, let your code express itself! #CodeIsPoetry #CreativeCode play.kotlinlang.org/...
131 3
Sam Cooper @sam-cooper.bsky.social · 01/04/2025
#AprilFools day seems like a good day to look back on that one time I wrote a song that's also a runnable #Kotlin program 🎶🎤🧑‍💻🤖 Leave a comment if you know what the program does! Read the whole story (and try running the code): medium.com/better-pr...
011 1
Sam Cooper @sam-cooper.bsky.social · 01/04/2025
#kotlin #aprilfools #tip: hype up your code with expressive extra punctuation. Try this: val date: String???? = "April 1"!!!! Follow my blog for more great hacks to supercharge your code medium.com/@sam-coop...
110 1
Sam Cooper @sam-cooper.bsky.social · 28/03/2025
Maybe a picture is a better way to explain it: medium.com/@sam-coop...
000 0
Sam Cooper @sam-cooper.bsky.social · 27/03/2025
Loved seeing my new #kotlin #coroutines book at the top of the @pragprog.com bestseller list last week! Looks like I'm giving up my crown to a bunch of worthy successors this week though (congrats to Mattias on the top spot)
172 7