09 Aug 2025 #csharp
Today, I found this Reddit question asking for the lower effort extension methods we’ve written.
And like any real C# programmer, I have my own set of extension methods to work with collections. But I ended up stealing one method from that thread: Choose()
. It applies a transformation to a list and only returns the resulting values different from null
.
It turns out, Choose()
comes from F#’s List
type. So my next step was to sneak into F#’s List
type and steal some of its methods.
Here they are,
public static IEnumerable<U> Choose<T, U>(this IEnumerable<T> source, Func<T, U?> selector)
where U : class
{
foreach (var elem in source)
{
var projection = selector(elem);
if (projection != null)
{
yield return projection;
}
}
}
public static U Pick<T, U>(this IEnumerable<T> source, Func<T, U?> selector)
where U : class
=> source.Choose(selector).First();
public static U? TryPick<T, U>(this IEnumerable<T> source, Func<T, U?> selector)
where U : class
=> source.Choose(selector).FirstOrDefault();
public static IEnumerable<T> Replicate<T>(this T source, int count)
{
for (int i = 0; i < count; i++)
yield return source;
}
public static IEnumerable<T> Singleton<T>(this T source)
{
yield return source;
}
And here’s a quick example of how to use them,
var movies = new Dictionary<int, string>
{
{ 1999, "The Matrix" },
{ 2000, "Gladiator" },
{ 2008, "The Dark Knight"},
{ 2003, "Freaky Friday"}
};
var years = [1995, 1997, 2010, 2003, 1999, 2000];
years.Choose(movies.GetValueOrDefault)
// "Freaky Friday", "The Matrix", "Gladiator"
years.Pick(movies.GetValueOrDefault)
// "Freaky Friday"
08 Aug 2025 #mondaylinks
Hey, there.
Here are 4 links I thought were worth sharing this week:
#1. PHP was my first love. I spent countless hours coding a recipe catalog using CodeIgniter to learn coding. To my surprise PHP just turned 30. And after 30 years, PHP has become the Toyota Coralla of programming (9min).
#2. It’s easy to spot AI-generated posts. Just look at the opening sentence. Look for anything like “In today’s fast-paced world.” But what about code? Here’s how to know when someone is vibe coding (3min).
#3. Reading code is an underrated coding skill. These days of too much vibe coding, reading code is the forgotten skill. If vibe coders only read the f*ing code (9min).
#4. What’s the secret behind success? It seems passion has a lot to do with it (2min).
And in case you missed it, this past week I wrote on my blog about how programming is becoming prompting (2min) and 7 life events that deserver a “shower” too (2min). That last one was half-joking. But the business shower doesn’t sound that crazy.
Last week I found out a Brazilian YouTuber translated one of my posts and reacted to it on his channel. I share the video here. Funny things that happen.
(Bzzz…Radio voice) This email was brought to you by… Check my Gumroad store to access free and premium books and courses to level up your coding skills and grow your software engineering career.
Coming soon: the “C# Fundamentals Bundle,” all of my beginner-friendly C# video courses to help you master the language from the ground up. Launching in just a few weeks, so stay tuned!
See you next time,
Cesar
Want to receive an email with curated links like these? Get 4 more delivered straight to your inbox every Friday. Don’t miss out on next week’s links. Subscribe to my Friday Links here.
07 Aug 2025 #coding
While curating this week’s Friday Links email, I found out about Dense Discovery and got inspired.
That newsletter features a section called Worthy Five where a subscriber shares 5 things worth watching, reading, asking…
So I’m stealing (like an artist) that idea, and tweaking it for new coders:
#1. A video worth watching.
Well, it’s more a lecture series. Watch Stanford CS106A on YouTube.
That’s an introductory course to programming. I watched all the lectures in the 2010s while learning to code. I loved the energy of the teacher and the exercises using video games to teach programming concepts.
Watch the first few lectures, you’ll love it.
#2. A question worth asking.
Ask what you want out of your career.
I jumped from job to job without any plan until I got bored or fired. At the end, I burned out after trying to make a “good” job work for me. I never took the time to set an intention for my career.
Come up with a career plan or goal. Remember you can always change it.
#3. A book worth reading.
OK, let me give you two.
First, Clean Coder. I enjoyed this one more than Clean Code. Clean Coder isn’t about writing code, but about being a professional developer. It covers professionalism, unit testing, and estimates.
The other one? Code That Fits Into Your Head. This isn’t precisely a book on syntax, but rather one about programming practices. Its main point? Write code in such a way you can keep its details in your head.
If you don’t know which one to pick first, go with Clean Coder.
#4. An activity worth doing
Write!
I’m biased here. I love writing. But, seriously, write anywhere online. To put your thoughts on paper. To document your learning.
Writing opens doors you can’t even imagine. For example, my blog has done more than a portfolio.
If you don’t know how to start, write TIL posts.
#5. A piece of advice worth passing on
Back at my first job, a coworker gave me this piece of advice:
Imagine you only make half of your salary, save and invest the other half.
Probably the best piece of advice I’ve received for free. Here are another two I never asked. That one helped me survive a layoff. Definitely worth passing on.
06 Aug 2025 #coding
Leon Martin wrote on dev.to that programming is becoming prompting.
And that’s true. The barrier to entry for coding is getting lower and lower.
A few years ago, it was the “Learn to Code” movement. Even Barack Obama replied to a coding question in an interview. One about sorting algorithms.
These days, with AI, anyone is one paragraph away from creating something that works.
Leon made two interesting points in his post:
#1. Too much AI is bad for your health
“…when you start writing prompts instead of functions, you stop flexing those problem-solving muscles that got you into programming in the first place.”
Been there! I’ve been using Copilot during my coding sessions. And the other day, I felt the urge to use AI instead of working through a simple problem.
And that’s the real danger of too much AI. Like the coder who asked on Reddit how to get his coding skills back after vibing for too long.
#2. AI needs the right hands
“Knowing how to code is still the superpower. The prompt is just a shortcut.”
Absolutely! AI is just like calculators in math class.
You could have the most powerful calculator in your hands during an exam, but if you don’t know what you want to compute, it’s useless. You will fail that exam.
AI is like an Iron Man suit. But it still needs Tony Stark inside it to save the day.
05 Aug 2025 #writing
Since January 2024, I’ve been growing my LinkedIn account.
As soon as you join the creator crowd on LinkedIn, you step into the gurus’ land with all kinds of advice:
- Comment more: Comment for 1 hour a day.
- Don’t schedule your posts: Always hit “Post.”
- Engage in the first hour to “warm up” the algorithm.
Follow the gurus’ advice, revealed after exclusively deciphering the algorithm, and you’d end up offering comments to the LinkedIn gods, writing your post of the day, and then commenting for another 1 or 2 hours under top creators’ posts to beg for their attention.
After writing over 300 posts, I’ve decided to ignore all those pieces of advice.
Instead, I batch and schedule my posts, and only engage to support fellow creators. And, I also make sure to reply to any comment on my posts.
Because you don’t have to play by anyone’s rules or follow anyone’s revealed secrets. You have to come up with an easy and sustainable strategy to show up consistently. And that’s true not just for LinkedIn, but for any creative pursuit.