Just Some Code

https://canro91.github.io/ (RSS)
visit blog
Never Run Promotions or Offer Discounts—Plus 4 More Lessons from Spain's Top Copywriter
16 Jan 2025 | original ↗

He went from unloading cargo trucks to being Spain’s best copywriter. So far I’ve only been following English-speaking copywriters. I write landing pages for my coding courses in English. That’s why I hadn’t heard of Isra Bravo. In a podcast interview, he shared his best lessons. You can watch the full interview here in Spanish. I only needed to...

There's Nothing Wrong With Coding Just to Pay the Bills
15 Jan 2025 | original ↗

I hate seeing “passionate” listed as a requirement in job postings. How can we measure passion? Is there a quiz, like those magazine questionnaires? “Find out if you’re a passionate coder in less than 5 minutes with 10 easy-to-answer questions.” The best coders I’ve met at past jobs weren’t what we’d call passionate. By passionate, I mean making...

Five Eye-Opening Lessons I Learned from Being Fired from My First Job
14 Jan 2025 | original ↗

I was fired from my first job. 10+ years ago. My first job taught me A LOT. I had 0 hours of flight time. Everything was new to me. I already shared some of those lessons the other day. But what I didn’t say that day was that I was fired from that job. Yes, fired. Not laid off. Fired. Same result, different cause. Did I deserve it? Probably. Did...

I'm Answering the (Bear) Blog Questions Challenge
13 Jan 2025 | original ↗

I’m not pouring a bucket of cold water over my head, but I’m doing this challenge. I found it in Kev Quirk’s blog. And he found it on somebody else’s blog. But the challenge started on Bear Blog. Ava started it. But since I don’t have a blog on that platform, I’m doing this challenge here instead. Just like Kev on his own blog. Here I go: Why did...

A Blog Has Been Better for My Career Than a Portfolio
12 Jan 2025 | original ↗

I don’t have a coding portfolio. By portfolio, I mean a webpage showcasing my best projects. My GitHub account is the closest thing to a coding portfolio. But it hasn’t helped me land jobs. My blog has helped me more. Some time ago, the next day after interviewing for a small local company, I got a phone call. They wanted me to start a company...

I'm Ditching My To-Do List: Here's What I'm Doing Instead
11 Jan 2025 | original ↗

I used to be a productivity freak with to-do lists. At a past job, I had a notebook where I wrote down every single action I needed to finish. Small tasks, large tasks, meeting notes… Everything. Later on, I became a plain text lover and kept my to-do list in a .txt file I edited with Notepad: a “todo.txt” file. Same story as my notebook at my...

If You Enjoy Coding, Think Twice About Joining the Management Track
10 Jan 2025 | original ↗

It took me 10 years to learn this lesson: The higher up you go, the less it’s about coding and more about all other skills. Being the best at coding won’t get you higher on the corporate ladder. Well, the corporate ladder is a trap. Unfortunately, few places offer growth opportunities for coders, and even fewer for those who don’t want the...

Stalking a Writer Online Made Me Change My Reading Strategy
9 Jan 2025 | original ↗

I’m a recovered book addict. Two years ago, I tried to read as many books as possible to show off my huge book count. But I didn’t remember much about those books, even when I took notes. Ironically, it was another book, The Almanack of Naval Ravikant, that made me change my mind. By pure accident, I discovered my new reading strategy. Last year,...

As a Team Leader, You're Not the Best Coder Anymore
8 Jan 2025 | original ↗

Promoting the best coder to team leader is how projects go sideways. I’ve seen it happen. One day, an executive pats the best coder’s shoulder three times. And the next day, he’s a team leader. No training. No expectations shared. Just a new title, a team, and lots of meetings. That new leader continues thinking in terms of lines of code and pull...

You Need Multiple Sources of Joy—A Job Alone Isn't an Option
7 Jan 2025 | original ↗

Diversify your sources of purpose and joy, the same way you should diversify your income. Otherwise, if you lose your only source of purpose and joy, you’ll feel lost. This happened to Vinay Hiremath, co-founder of Loom- the online screen recording tool. After selling his company, he’s rich and has no idea what to do with his life. He wrote about...

10 Inspiring and Thought-Provoking Quotes About Life and Money I Collected in 2024
6 Jan 2025 | original ↗

Photo by Andrej Lišakov on Unsplash I’m not a quote addict. And I don’t collect quotes for a living either. These weren’t intended to be quotes. But they’re pieces of wisdom I noticed and wrote down when consuming content as part of my daily procrastination. Sorry, I meant catching up. From James Altucher—Writer, entrepreneur, and investor Last...

You Only Need These Four Books To Change Your Relationship With Money
5 Jan 2025 | original ↗

Photo by Annie Spratt on Unsplash Money is one of the skills we have to learn by ourselves. I didn’t have a class called “Money” in high school. And if you went to a regular high school like me, you didn’t either. Like it or not, we live in a world run by money. And still, we don’t learn a thing about money. What we know about money is what we...

I Got Laid Off and Recovered From Burnout in 2024. Here are 13 Lessons and Realizations
4 Jan 2025 | original ↗

Writing is free therapy. Detach your sense of meaning from your work. You don’t need to find a “passion” to succeed. Working on your health brings clarity to your life. You are not your job title. You’re way more than that. Do what you can control and let go of everything else. Stop chasing a fancy title. Optimize for a lifestyle...

How I Correct Mistakes When Practicing Foreign Languages
3 Jan 2025 | original ↗

It’s discouraging when a teacher corrects your mistakes in every phrase. It makes you want to stop speaking. I’ve had all types of teachers: The ones who cut you off in the middle of every sentence to correct you The ones who write corrections on a whiteboard The ones who don’t correct at all We need the right balance when learning a new...

If You're Starting a Creative Project, Remember This Law
2 Jan 2025 | original ↗

90% of everything is crap. And I’m not making that up. It’s Sturgeon’s Law. That’s not discouraging. It’s relieving, at least for me. It lowers our expectations when starting any creative project, like writing or painting, for the first time. Our first posts, paintings, or pictures will be in that 90% My first post was in the 90% of crap. I wrote...

Best of 2024: My Year in Review
1 Jan 2025 | original ↗

If I had to define my 2024 in one word, it would be: Change. In 2023, I got burned out and sick. And when I was laid off in early 2024, I felt both worried and relieved. I needed some time off. That layoff taught me valuable lessons about life, career, and money. My coding side 2024 felt like a rollercoaster. After getting laid off and sending...

The Best Way to Get Better at Writing Code Isn't Just Writing More Code
31 Dec 2024 | original ↗

More than 10 years ago, I started my real coding journey with a Google search: “How to be a better developer.” University had taught me a lot of things I didn’t need. I had to teach myself the ones I needed. I went down the rabbit hole. That search gave me lots of ideas and inspiration: Write specs Write unit tests Document your code ...

Here's the Best Productivity Hack I Learned in 2024
30 Dec 2024 | original ↗

It wasn’t a time management technique. It wasn’t the Eisenhower Matrix, Eat That Frog, or the Pareto Principle. It was an energy management technique: eating better. Eating better. Eating for energy. Eating better means no processed foods, no carbs, and no sugar. We all know we should eat better. Nothing new! Right?! But from “Glucose Revolution”...

The Best Books I Read in 2024 (Even If I Didn't Read Many)
29 Dec 2024 | original ↗

In 2024, I stopped being a serial book reader, keeping a tally of books I read. I went from “let’s read anything and everything” to “let’s read what I need to read.” From just-in-case to just-in-time reading. I realized I had a long list of book notes, but I didn’t remember reading some of those books. Naval Ravikant’s reading strategy helped me...

One Technique to Ease Your Onboarding—and Not Make New Team Members Feel Lost
28 Dec 2024 | original ↗

The first moments show how you’re going to be treated for the rest of the time. It applies when you go to a restaurant, call a customer service line, or go to a bank. And the same is true when joining a new team as a developer. The first day I joined my last full-time job was awful. I was speaking a foreign language for work for the first time. I...

An Easy (And Clever) Way to Write a Non-Fiction Book
27 Dec 2024 | original ↗

Writing a book is a sign of prestige and a synonym of expertise. A book brings interviews, talks, consulting gigs, and more opportunities. Sales don’t bring the most money, but the doors it opens do. That’s what I’ve heard. If you think of publishers, pitching, and rejection when you think of publishing a book, there’s the self-publishing route....

The Surprising Lesson from My First Online Writing Class
26 Dec 2024 | original ↗

This year, and for the first time since University, I took a writing class for the Internet. It was a webinar, to be precise. Tim Denning and Todd Brison ran it. The main lesson? Write daily. Daily?! Yes, daily. That was shocking. I was used to writing on my blog when I felt I had something to say. Usually, once a month. Later, when I gained some...

We Shouldn't Call Them Best Practices—And Blindly Follow Them
25 Dec 2024 | original ↗

We, as coders, take pride in preaching and following best practices. Don’t write SQL, use an ORM. Don’t write conditionals, use design patterns. Don’t throw exceptions, use Results…Don’t do that, do this. Those “don’t do that, do this” hide all the context in which they make sense. That’s the part we skip and don’t tell when we preach best...

Don't Write to Seem Smart, Write Like This Instead
24 Dec 2024 | original ↗

Don’t write to seem smart or to sound like a famous writer. That will only make you use technical jargon, complicated words, and long boring paragraphs that scare people away. Instead, write for only one person. Every time you sit to write, imagine you’re writing for a friend, coworker, or your past self. It will give you the right tone, context,...

One Language Trick I Use to Ace Interviews in a Second Language
23 Dec 2024 | original ↗

Interviews are intimidating. You don’t know what you’re going to be asked. You don’t know if the interviewer will like you. You have to remember what you wrote on your CV. That makes interviews intimidating for sure. But the ones in a second language are worse. Are my speaking skills good enough? What if I don’t understand my interviewer’s...

3 Lessons I Learned from Watching Two Millionaires Talk About Money
22 Dec 2024 | original ↗

Having too much money brings a different set of challenges. That’s one of the takeaways from this conversation between two millionaires. It’s one episode of the “Deep Dive with Ali Abdaal.” This time Ali sat down with Andrew Wilkinson. Here’s the link to the YouTube episode if you want to watch it. Ali Abdaal started medical school, then became a...

How A Salary Messed With My Mind—Two Realizations After a Layoff
21 Dec 2024 | original ↗

“Wait, I’m not working anymore.” Being laid off feels weird. Moments of relief followed by a “What am I going to do now?” Some days after being laid off last January, something weird happened. I didn’t realize I had ingrained this “habit.” Midway through rushing to my laptop to reply to my Teams messages, I suddenly stopped my short commute from...

I'm Following This Plan To Learn Enough Copywriting To Be Dangerous
20 Dec 2024 | original ↗

Writing is the superpower to survive in the online world. All online content starts with writing. A video begins with a script, a course with a series of posts, and a long post with a Tweet or short-form post. And guess what? Marketing and sales start with writing, too. A landing page, an email sequence, a product description, and an ad. That’s...

Stop Time Traveling—Yes, You're Already Doing It
19 Dec 2024 | original ↗

You don’t need to speed a DeLorean to 88mph to time travel. In fact, you’re already doing it. Every time you go into your head to relive past situations, you’re time traveling. And every time you go into your head to anticipate future situations, you’re time traveling too. I declare myself guilty of time traveling. I’ve time traveled to the day...

You're an Alarm Away from Being Healthier, Wealthier, and Happier
18 Dec 2024 | original ↗

Phones are not just communication devices. They’re distraction machines with constant beeps and buzzes. Keeping our phones around reduces our cognitive abilities, even when we’re not using them. I learned this from reading “The Anxious Generation,” by the way. But that doesn’t mean we can’t use those beeps and buzzes to our advantage. They can be...

I Followed This One Trick to Write Better Headlines. Here's What I Found
17 Dec 2024 | original ↗

“Five times as many people read the headline as read the body.” That’s a quote from David Ogilvy, “the father of advertising.” It applies to the copywriting world, as well as other forms of writing. A good headline is like the welcome sign for the rest of your piece. People passing by will choose to read only after seeing a good headline. No...

It's OK if You Don't Have a Single True Passion
16 Dec 2024 | original ↗

Photo by Astrid Schaffner on Unsplash “Find your passion” has always stressed me out. That advice assumes we all have a single true passion we can find within ourselves. I’ve always had trouble finding that one true passion ever since high school. I got good grades in all subjects, with more effort in some than others. Picking one thing wasn’t...

How Do I Organize My Blogging Workflow
15 Dec 2024 | original ↗

A schedule and an easy-to-follow workflow. That’s what you need if you want to keep blogging in the long run. I started blogging back in 2018. I threw up some words in a file and put them online. No schedule or intentions. Only when I adopted a writing schedule, I started to improve my writing skills and notice more pageviews. To preserve my...

Follow This 1 Tip to Truly Stay Consistent With Any Skill
14 Dec 2024 | original ↗

Want to master any skill? Simple! Show up. Consistency is king. Do something every day for one year. That’s common Internet advice to master a skill and crush your goals. Want to write? Show up. Want to get in shape? Consistency is king. Easier said than done. Show up is good advice. But it’s only part of the full piece of advice If you want to...

Keeping Your Phone Around Reduces Your Cognitive Capacities
13 Dec 2024 | original ↗

That was the result of a study by the University of Texas, cited in the book “The Anxious Generation.” In the study, they divided an undergraduate classroom into thirds. One third left their phones in another room. Another third kept them in their pockets or bags. And the last third kept them facing down on their desks. Guess who performed best...

5 Life-Changing Purchases I've Made Since 2020
12 Dec 2024 | original ↗

I’m answering this Hacker News question: Is there anything you’ve bought in the past few years (since 2020) that really changed something in your life? They didn’t change my life, but they’ve made it somewhat better: A pair of 5-kg dumbbells: Cheaper than a yearly gym subscription. With a couple of YouTube videos, they’re enough to keep...

Being In A Self-Managed Team Made Me Try The Most Expensive Hamburgers I've Eaten
11 Dec 2024 | original ↗

I didn’t pay for the most expensive hamburgers I’ve eaten. An ex-employer did. When I say “most expensive,” I mean the same greasy $5 or $10-dollar hamburger from a food truck or a corner in a busy street. But they felt expensive because I ate them while working overnight. In a past job, when my team was lagging behind the self-imposed deadlines...

Six Inspiring Lessons I Learned from Jim Kwik, the Brain Coach—in Six Quotes
10 Dec 2024 | original ↗

Jim Kwik is “the world’s #1 brain performance coach.” But he wasn’t always someone we would consider smart. In school, he was called “broken” because of his learning issues. He wasn’t as fast as his classmates and couldn’t read. An accident caused him brain injuries that put him behind his class. Believe it or not, he now teaches the very same...

8 Unexpected Lessons I Learned from Watching One of My Favorite TV Shows—Scorpion
9 Dec 2024 | original ↗

Scorpion's team. Via: themoviedb.org Imagine The Big Bang Theory marrying MacGyver. That’s Scorpion. Scorpion, aired between 2014 and 2018, follows a team of four geniuses (and two or more “normal” people depending on the episode) solving impossible cases for the Department of Homeland Security. Walter O’Brien, the guy with one of the highest IQ...

Who Would You Trust: The CEO Or The Janitor?
8 Dec 2024 | original ↗

More than 25% of new Google code is generated by AI. That’s what Sundar Pichai, CEO of Google, announced in the last earnings call—Q3 2024. That’s scary. Not because AI is taking our jobs, but because they’re relying on who knows what kind of code. And if human-generated code has created all sorts of problems, what about the AI-generated code?...

One Simple Trick to Avoid Writer's Block
7 Dec 2024 | original ↗

I almost broke my daily writing habit today. Starting on November 1st, I began writing daily here on my blog. I chose to go with a good headline and one main idea. That’s good enough to mark the calendar and call it a day. No need for an introduction, 10 main points, and a conclusion. I start my writing sessions after sitting in silence for 10...

Always Be Writing About What You Do at Work
6 Dec 2024 | original ↗

That’s better than simply claiming on your CV that you did something. Write about what you’re doing and what you’re learning at work. For example, write about: Challenges you’re facing while solving a problem. Lessons you’re learning from every project. Checklist you use to review pull requests. Most common code review comments you...

How a Layoff Feels—And How to Prepare for the Next One
5 Dec 2024 | original ↗

Do you have a minute? That was the last message you got from your boss’ boss. Earlier that day, you logged in to work as usual. And you had a couple of “Are you still around?” messages. You knew it was happening. Again. Then came a quick goodbye message from another colleague. He shared his email and contact details. You went through the daily...

If You're Looking for Red Flags Once You're in a Job, It's Too Late
4 Dec 2024 | original ↗

It all starts with the job description. No job description? Red flag. “We’re looking for a passionate coding ninja to join our family. We work in an agile and fast-paced environment. We’re looking for a coder with 5 years of experience who can work on our public web page, mobile app, backend, frontend, DevOps, security, compliance, sales,...

Who Isn't This For?
3 Dec 2024 | original ↗

It’s more important to ask who this isn’t for than who this is for. Who isn’t this course for? Who isn’t this coaching program for? Who isn’t this blog post for? I created a Udemy course on unit testing, one of my favorite subjects. I answered who this course is for on the landing page. One student said some parts were too advanced. He had just...

Stop Being Afraid of Hitting Publish on LinkedIn With These 9 Proven Strategies
2 Dec 2024 | original ↗

Publishing your first LinkedIn posts is scary. I know that feeling. Your hands shake. Your heart is beating. You keep retyping your password. You’re publishing something on the Internet for the first time ever. You’re in fight or flight mode, ready to run away from lions behind a bush. What if I say something wrong? What if my boss reads what I...

Who Gets Promoted Higher and Faster at Work?
1 Dec 2024 | original ↗

It’s not the best coder. It’s not the one who cranks out more pull requests or lines of code. The one who gets promoted higher and faster is the one with the best soft skills. The best communicator. The one who’s best at explaining complex subjects to non-tech people. The best at dealing with people. The best coders are left alone to continue...

This Is Why We Don't Test Private Methods
30 Nov 2024 | original ↗

Trying to test private methods causes a lot of confusion. That’s a common question we all have made when finding unit testing for the first time. These days, I found that very same question on Reddit: Can someone explain to me why unit testing our private methods is bad? Because we don’t want to break encapsulation. If you have a private...

Always Be Reading. But Reading More Isn't Always the Answer
29 Nov 2024 | original ↗

Before finding “The Almanack of Naval Ravikant,” I was a ferocious reader. I was in the “let’s read as many books as we can” team. By pure FOMO, I was trying to follow YouTube trends like “I read 9,999 books about money, here’s what I learned” and the mantra “read one book per week.” But out of dozens of books I had read, I didn’t remember...

Find Your Producer's Switch
28 Nov 2024 | original ↗

That’s Leland Sklar’s strategy, a well-known bass guitar player and session musician. He’s appeared on over 2,000 albums, based on his Wikipedia profile. While recording in a studio, if a director asked him to change the sound, he simply turned on or off a fake switch and continued playing. This is what he said during an interview for Guitar...

The Easiest Way to Be Ignored When Communicating at Work
27 Nov 2024 | original ↗

Only send “Hello, how are you?” in Teams or Slack at work. You’ll get ignored immediately. Especially if you’re working in a remote team with people all over the world. And especially if you’re reaching out to a busy manager or executive. That’s how that “Hello, how are you?” conversation will look: Hello, how are you? … Good, thanks. And...

Did You Have a Mentor, and Did It Help You?
26 Nov 2024 | original ↗

That’s question I found on dev.to. Here’s my full answer: I’ve had mentors. But, not formally and without the label. I can pinpoint two or three people in my career that were like “mentors.” At a past job, I had the chance to work next to my team architects and learned a lot from them. From the value of reading other people’s code to rejecting...

How I'd Learn a Language for Work From Scratch
25 Nov 2024 | original ↗

It took me two years to learn English. And by “learning English” I mean, a traditional language school gave me a signed piece of paper that says I speak English. After two years, lots of repeat-after-me sessions and grammar exercises, someone finally said I was able to speak English. I didn’t start learning English from scratch. We’re taking...

In a Couple of Decades, There Won't Be Many People Who Can Write
24 Nov 2024 | original ↗

There will only be writes and write-nots. That’s Paul Graham’s prediction about the future of writing in the days of AI. Here are my comments on Paul Graham’s post: 1. “To write well you have to think clearly, and thinking clearly is hard” Clear thinking is the most important reason to write. You need to order your thoughts before putting them on...

Big Problems Demand Small Solutions
23 Nov 2024 | original ↗

That was what Seth Godin answered during an interview with Jim Kwik for the Kwik Brain podcast. Jim asked him about mindset shifts for people stuck in the ideation phase, struggling to take action. Then Seth expanded his answer by saying: “Let’s start with a small solution first…Let’s figure out what’s the smallest habit change that would lead...

Everybody Has An Accent. And That's Okay
22 Nov 2024 | original ↗

In professional settings, native speakers aren’t the ones who reject non-native speakers by their speaking skills. Other non-native speakers are. The other day I referred a friend (with good English skills. B2, probably) to the same software agency I was working with. He got rejected. The recruiter (another non-native speaker) rejected him...

A Simple Way to Start Your Creative Journey? Put Your Fingerprint on Something Every Day
21 Nov 2024 | original ↗

There are 7 billion people and 7 billion unique fingerprints. This means that anything you put your fingerprint on is unique. To start your creative journey, recreate something you like, by adding or subtracting your own taste. You will put your fingerprint on it. You will make it unique. I’m putting my fingerprint on this idea. I found it in...

Read 500 Books About a Subject to Reinvent Yourself
20 Nov 2024 | original ↗

What is “it”? How do I know what I should do? Whatever area you feel like reading 500 books about. Go to the bookstore and find it. If you get bored three months later go back to the bookstore. That’s from “Reinvent Yourself” by James Altucher. When he was bankrupt, to get back up again, he started to read 500 books about money. He recommends...

Why Learn a (Foreign) Language — Even When We Have AI and Many Other Tools These Days
19 Nov 2024 | original ↗

Apart from monetary reasons—learning a second language helped me double my last salary as a full-time employee: 1. Because AI can’t replace human connection From “How to Win Friends and Influence People,” the trick to having good conversations is to make them about the other person. And the easiest way to make conversations about the other person...

Coders Often Don't Get To Solve Problems
18 Nov 2024 | original ↗

Coding is about solving problems with automation. The most interesting and funniest part is figuring out a coding solution to a problem. But often, by the time a coder is involved, all the big picture thinking and decision making have already been made, killing all the fun. Somebody else already talked to customers. Somebody else decided what to...

The Best Time To Look for a New Job
17 Nov 2024 | original ↗

It’s not when you’re “let go.” The best time to look for a job is when you don’t need one. You’re not desperate to pick anything to just pay the bills. You’re in a better position to negotiate. You can use your new offer as leverage in your current job. You don’t have anything to loose. That was a lesson I shared with a group of friends and...

Two Quotes I'm Trying to Live By
16 Nov 2024 | original ↗

#1. “I’m a simple man making his way through the galaxy, like my father before me” If you’re a Star Wars fan, you recognize that phrase. That’s by Boba Fett from The Mandalorian. We’re all here trying to figure out our paths. Some are more intentional about it, others are not. Some have found it, others are still searching. Every stage in life...

Learn To Talk to Non-Tech People in Your Team
15 Nov 2024 | original ↗

That’s a crucial skill to master for every coder, even if you’re not in the path to be a team leader. We take pride in dropping any technical jargon during our conversations. It makes us look smart. But true mastery is explaining things to people outside our fields. At a past team, while working on a hotel management software, we found an issue...

Getting Rid of Nulls Is Indeed A Good Idea
14 Nov 2024 | original ↗

These days I found a Medium article titled: Why Eliminating NULLs From Your Code Will Not Make Your App Better. Its point is that when we stop using null, we replace checking for null with checking for a default value or a wrapper like Result. And there’s no major gain. But there is. The advantage of returning a wrapper like Option or Result...

Two Blogging Tips to Write More
13 Nov 2024 | original ↗

Inspired by Seth Godin and Herbert Lui, I looked up other people writing daily on their personal blogs and found these two pieces of advice: 1. If it’s longer than a Tweet, 280 characters, it can be a post. That’s from Mike Crittenden’s 2 months of daily blogging. Post length doesn’t matter if we transmit the message clearly in a few words. A...

Two Alternatives to Assertion Messages — and Two Ideas if You Do Want To Keep Them
12 Nov 2024 | original ↗

I got this question from Ankush on my contact page: “I want to override the Assert method to avoid using Assert.True without a failure message. How can I achieve it?” Here are 2 alternatives to assertion messages and 2 ideas if you do want them: 1. Don’t use assertion messages. Write better test names instead. Test naming conventions, like the...

9 Lessons I Learned After Following James Altucher's Work
11 Nov 2024 | original ↗

It’s hard to define what James Altucher does. He’s an investor, podcaster, writer, chess player, and comedian. That’s only what he shares on podcast interviews. Who knows what his next career will be. I found James Altucher’s work by pure accident. I was looking for ways to get better at writing and found the advice of writing 10 headlines a day....

It's Better To Be Poor Doing Something You Love, Than To Be Rich Doing Something You Hate
10 Nov 2024 | original ↗

That’s a quote I found last week while watching a conversation between Tom Bilyeu and Rich Roll on YouTube. They were discussing Tom’s mindset changes and work history. That quote is an invitation to reflect what we’re willing to give up in exchange for money. It reflects what I’ve been going through since last year. In 2023, I hit rock-bottom....

Your Keystrokes Are Limited, Here's How You Preserve Them
9 Nov 2024 | original ↗

Preserve your keystrokes. They’re limited. That’s a piece of advice I learned from one of Scott Hanslman’s talks about productivity. This isn’t an invitation to write less or write shorter content. It’s an invitation to make private knowledge public. Often valuable knowledge and lessons die in email threads or Slack channels. Apart from the...

This Is the Real Reason Why Coders (and Everyone Else) Should Write
8 Nov 2024 | original ↗

Don’t write to attract recruiters or create a brand. Sure. Those are benefits of writing online. When we write online, good and unexpected things happen. By writing online, we gain followers, build a brand, attract opportunities, and skip hiring lines. By luck or accident, I made my first internet money writing, because I showed some of my posts....

From Now On Here's How I'm Answering: What Stocks Should I Buy?
7 Nov 2024 | original ↗

“What companies should I buy in my brokerage account?” That was a question that popped up in a Whatsapp group with some of my ex-coworkers and colleagues. In fact, it was not the first time that question popped up. From the same person. Here’s what I answered: “If you don’t want to be a full-time investor, go with a broad market index fund. If...

LinkedIn Shouldn't Have a Desperate Frame and You Shouldn't Look That Needy
6 Nov 2024 | original ↗

Hiring in 2024 has been slow. I know! I was “let go” in February and tried to find a job for a couple of months until I gave up and decided to jump solo. AI, high interest rates, or anything else have changed the job market. There aren’t as many open applications as years before. And the few ones opened get flooded with applications. Pure radio...

Want to Be More Creative and Change Your Life? James Altucher Shows You How
5 Nov 2024 | original ↗

Write 10 ideas every day. About anything. That’s it! Thanks for reading. Don’t forget to like and subscribe…Still here? Now, seriously… If you don’t know James Altucher’s work: he’s an American investor and author. He sold one of his first businesses for millions and lost everything. Not once, but a couple of times. In his darkest moments, about...

The Day I Realized I Needed to Raise My Rates as a Coder
4 Nov 2024 | original ↗

Hourly billing is nuts. I learned that from Jonathan Starks. Charging by the hour doesn’t encourage productivity. To make more money, you have to work slowly or pad your time sheet. In either case, you’re not being honest. Even knowing that, I agreed to work as a contractor for a small software agency charging by the hour. After every task, I...

If a Language Learning Forum Were Like a Coding Forum:
3 Nov 2024 | original ↗

Question: Guys, how do I say “I love you” in Japanese? — Japanese? Why don’t you try German? It’s easier in German — If you want to talk about love, you should try with French — Yeah, go with French. That’s the language of love …Question downvoted — Wait, isn’t Spanish the language of love? — Guys, the thing is I have this text at work and I need...

Passive Learning Is Just Entertainment Unless You Follow These Two Strategies
2 Nov 2024 | original ↗

Passive consumption is procrastination in disguise. If you’re like me, you’ve been watching another YouTube video, reading another book, and consuming online content as procrastination. Mindless consumption isn’t learning. Learning should be active. We truly learn when we engage in our learning process. Instead of simply reading or watching...

It's Not About Selling. It's About Helping
1 Nov 2024 | original ↗

The other day I had a weird DM exchange. A guy shared a cool LinkedIn tip. I rushed to apply it and DMed him to say thanks for that cool idea. You know I wanted to make friends in the DM. He continued the conversation. I shared how my LinkedIn journey was going. I told him about my 100-post experiment and my future plans. After a couple of...

The Power of Function Composition — to Find If an Array Is Special
30 Oct 2024 | original ↗

Passing the result of a function to another isn’t the only way to compose two functions. From math classes, we’re used to composing two functions like this compose(f, g) = x => f(g(x)). But it turns out there are more ways. That’s my main takeaway from the talk “The Power of Function Composition” by Conor Hoekstra at NDC Conference 2024. Here’s...

Using Lambda Expressions Doesn't Make Your C# Code Functional
29 Oct 2024 | original ↗

C# will never become a truly functional language. Sure, C# is borrowing features from functional languages like records, pattern matching, and switch expressions. But it doesn’t make it a functional language. At its core, C# is an Object Oriented language — with mutable state baked in. But it doesn’t mean we can make it functional with a few...

14 Quick Career Lessons After 10+ Years (and Lots of Trial and Error) as a Software Engineer
21 Oct 2024 | original ↗

Coding is the easy part of software engineering. We don’t get an instruction manual to survive the corporate world and navigate the “people and interactions” side of software engineering. After over 10 years, 3 jobs, 2 “we have to let you go,” and lost of trial and error, these are 14 lessons I’ve learned while navigating a career as a software...

Learning a Second Language Could Be Your Best Career Decision — Start With These 7 Steps
14 Oct 2024 | original ↗

Learning a second language has been my best career decision. Literally, it changed my life and doubled my salary. Initially, I learned English to make my CV look more attractive to recruiters. But learning English has been more than a better CV for me. It took me a couple of years to learn English and an extra couple of years to take full...

I'm Moving Monday Links to an Email List
10 Oct 2024 | original ↗

Bye, Monday Links. Hello, Friday Links. For months, I ran a series called Monday Links, here on my blog. Every time I found interesting posts about programming and software engineering, I compiled them until I had five or six and then published them in a post. It was a way to document what I read and react to the other people’s posts, when my...

I Hope You Don't Have To Write a CV. But if You Do, Follow These Tips
7 Oct 2024 | original ↗

CVs are so last century. I hope I don’t have to write a CV anymore. I hope you don’t either. A personal brand is the new CV and portfolio. But since you’re reading this one, probably you still need to write a CV. I wish it won’t end up in the dumpsters behind a company careers page. I’ve tried that route with zero results. More than once, some...

TIL: How to Use the Specification Pattern in C# to Simplify Repositories
30 Sept 2024 | original ↗

Repositories are the least SOLID part of our codebases. When we work with Domain-Driven Design, we take care of our business domain and forget about our data-access layer. We end up dumping, in a single interface, every combination of methods and parameters to retrieve our entities from the database. This way, we break the Single Responsibility...

How to Handle the Startup Class When Migrating ASP.NET Core Projects
25 Sept 2024 | original ↗

.NET 6.0 replaced the Startup class with a new hosting model and a simplified Program.cs file. The Startup class is still available in newer versions. If we’re migrating a pre-.NET 6.0 project, the .NET upgrade assistant tool does the work while keeping the Startup class. Here are 3 alternatives to handle with the Startup class when migrating to...

Four Lessons and a Challenge for a Coder Struggling to Write
23 Sept 2024 | original ↗

Last week, Syed, one of my email subscribers, shared his struggles with writing online. Here’s an edited version of Syed’s email: I wanted to start writing about my debugging journey of the things I had been stuck with long time and then solving it finally… But I couldn’t continue as I thought my website wasn’t the best with SEO and no one may...

Four Writing Lessons I Learned After Binge-Reading Hertbert Lui's Blog
16 Sept 2024 | original ↗

A Sunday evening free of dopamine ended up being a lesson on writing and blogging. I started googling about note-taking and landed on Herbert Lui’s blog after finding his lessons after 800 Zettelkasten notes. In case you don’t know Herbert Lui’s work, he’s a writer, editorial director, and book author. He wrote Creative Doing, a book with...

Follow These 3 Tips To Never Run Out of Writing Ideas
9 Sept 2024 | original ↗

Running out of ideas is the greatest fear of new writers. But don’t worry. You’re not running out of ideas. You have plenty of them. You need to be aware of the content you consume and have writing prompts to help you write. Here are 3 tips to never run out of ideas to write: 1. Become a DJ of Ideas There’s nothing new under the sun. And it has...

What My First Job as a Software Engineer Taught Me About Coding and Life
2 Sept 2024 | original ↗

My first coding job was far from being like a Silicon Valley job at a startup. I didn’t have ping-pong tables or slides to go between offices. It was, by all means, a boring job at a local non-tech company. There’s nothing wrong with a boring job if that’s what you want. But it taught me valuable lessons about life, coding, and money. Here they...

It Seems the C# Team Is Finally Considering Supporting Discriminated Unions
19 Aug 2024 | original ↗

C# is getting more and more functional with every release. I don’t mean functional in the sense of being practical or not. I mean C# is borrowing features from functional languages, like records from F#, while staying a multi-paradigm language. Yes, C# will never be a fully functional language. And that’s by design. But, it still misses one key...

For Cleaner Domains, Move IO to the Edges of Your App
5 Aug 2024 | original ↗

Don’t get too close with I/O. That’s how I’d summarize the talk “Moving IO to the edges of your app” by Scott Wlaschin at NDC Sydney 2024. In case you don’t know Scott Wlaschin’s work, he runs the site F# for Fun and Profit and talks about Functional Programming a lot. He’s a frequent speaker at the NDC Conference. Here’s the YouTube video of the...

5 Unit Testing Best Practices I Learned from This NDC Conference Talk
22 Jul 2024 | original ↗

Recently, I found a NDC talk titled “.NET Testing Best Practices” by Rob Richardson. Today I want to share five unit testing best practices I learned from that talk, along with my comments on other parts of it. Here’s the YouTube video of the talk, in case you want to watch it, and the speaker’s website, During the presentation, the speaker coded...

What I Don't Like About C# Evolution: Inconsistency
8 Jul 2024 | original ↗

C# isn’t just Java anymore. That might have been true for the early days of C#. But the two languages took different paths. People making that joke have missed at least the last ten years of C# history. C# is open source and in constant evolution. In fact, you can upvote and discuss feature proposals in the C# official GitHub repo. Every .NET...

New Developers Looking for a Mentor: Here's a (Free) Mentorship Session in 8 Lessons
24 Jun 2024 | original ↗

You don’t need to meet your mentors. I read that Napoleon Hill, the author of “Think and Grow Rich,” talked to his mentor only once, and he said it changed his life. I’d be happy to share some advice over a virtual coffee in an “ask-a-friend” style. But to preserve my keystrokes and help more than one person, here I go. I’m writing for my...

Testing DateTime.Now Revisited: .NET 8.0 TimeProvider
10 Jun 2024 | original ↗

Starting from .NET 8.0, we have new abstractions for time. We don’t need a custom ISystemClock interface. There’s one built-in. Let’s learn how to use the new TimeProvider class to write tests that use DateTime.Now. .NET 8.0 added the TimeProvider class to abstract date and time. It has a virtual method GetUtcNow() that sets the current time...

I applied at a FAANG and failed: Three interviewing lessons
27 May 2024 | original ↗

Overconfidence killed all my chances of success. I applied for a role as a software engineer at a FAANG or MAGMA or insert-newest-acronym here. And I failed. I thought: “I have more than 10 years of experience. I’ve seen quite a lot.” A “short coding assessment” got me off guard. 80 minutes and 3 exercises made me feel like an impostor. An...

Steal This 6-Step Reading Process To Retain More From Books
13 May 2024 | original ↗

Reading more books isn’t the answer. In the last two or three years, I read dozens of non-fiction books. The truth is I don’t remember reading some of them, even when I took notes. I don’t even remember their front cover or why I decided to read them. I was reading to increase a book count. Pure FOMO. Without realizing it, I was trying to copy...

AI Won't Take Our Coding Jobs Yet. But The World Will Need Different Coders
29 Apr 2024 | original ↗

On March 12th, 2024, the coding world went nuts. That day, Cognition Labs announced in their Twitter/X account the release of Devin, “the first AI software engineer.” That announcement made the coding world run in circles, screaming in desperation. It also triggered an interesting conversation with a group of colleagues and ex-coworkers. Here’s a...

Two new LINQ methods in .NET 9: CountBy and Index
15 Apr 2024 | original ↗

LINQ doesn’t get new features with each release of the .NET framework. It just simply works. This time, .NET 9 introduced two new LINQ methods: CountBy() and Index(). Let’s take a look at them. 1. CountBy CountBy groups the elements of a collection by a key and counts the occurrences of each key. With CountBy, there’s no need to first group the...

How to Test Logging Messages with FakeLogger
1 Apr 2024 | original ↗

Starting with .NET 8.0, we have a better alternative for testing logging and logging messages. We don’t need to roll our own mocks anymore. Let’s learn how to use the new FakeLogger inside our unit tests. .NET 8.0 introduces FakeLogger, an in-memory logging provider designed for unit testing. It provides methods and properties, such us...

How I used AI to launch my new testing course
18 Mar 2024 | original ↗

I ran an experiment. Maybe it was fear of missing out. I decided to use AI to help me launch a new course. This is how I used Copilot and the prompts I used. I got this idea after watching one of Brent Ozar’s Office Hours videos on YouTube where he shared he keeps ChatGPT opened all the time and uses it as a junior employee. I decided to run a...

Extreme Ownership: How U.S. Navy SEALs Lead and Win. Takeaways
4 Mar 2024 | original ↗

By the title, I guess you infer this isn’t a book about software engineering or programming. It’s about leadership. By any means, I’m advocating for war. But I think the military has to teach a lot about management and leadership. For years, they have been leading large organizations with complex tasks in changing environments. That sound a lot...

Monday Links: Notebooks, Learning, and KPIs
19 Feb 2024 | original ↗

Five interesting reads from the past month. Lab Notebooks I like the idea of keeping “lab” notebooks, especially to record the thought process for consulting clients. I’m a big fan of plain text. But the article recommends using pen and paper. Read full article Git Things Git and Version Control are one of the subjects we have to learn ourselves....

This Project Taught Me More About Leadership Than Programming: Two Postmortem Lessons
5 Feb 2024 | original ↗

Leadership and communication are more important than coding for the success of a project. Last year, I worked as an independent contractor and engaged in short projects with an American client. This project was a six-month effort to bring group events, like weddings, conferences, and retreats, to a property management system. This was one of the...

Monday Links: NDC Copenhagen
22 Jan 2024 | original ↗

These are four NDC conferences from the past Copenhagen edition. Iron Man or Ultron: Is AI here to help us or hurt us? “We want our AI’s to be like an IronMan suite. Not like Ultron. If IronMan does something cool in his suit, he gets the credit for it. If IronMan is not in the suit, then the suit is just this empty shell” Is everything...

Best of 2023
8 Jan 2024 | original ↗

In 2023, I realized that I’ve been blogging for five years. I started this blog to keep some notes online. Since then, I’ve used my blog to share my learned lessons, answer questions, and rant out loud. I consider my blog as my time capsule. Last year, I wrote 23 posts. I tried to write one post every other week. I wrote a series of posts about...

TIL: How to color a website based on its URL. A visual aid and time saver
27 Nov 2023 | original ↗

These days, I spent a while debugging an issue. After a couple of minutes of scratching my head, I realized I was looking at log entries in the wrong environment. I know! A facepalm moment. I decided to look for a way to change the colors of a browser tab or a website based on the URL I visited. This is what I found. Coloring a website per URL...

TIL: How to declutter sites with uBlock Origin filters
13 Nov 2023 | original ↗

These days while procastinating on HackerNews, I found this submission. It points to a GitHub repo with some uBlock Origin filters to clean up websites. I learned that I not only can block elements in a page with uBlock Origin, but also restyle them. Ding, ding, ding! These are the uBlock Origin filters I’m using to declutter some site I visit...

TIL: Five lessons while working with OrmLite
30 Oct 2023 | original ↗

Back in the day, for my Advent of Posts I shared some lessons on Hangfire and OrmLite. In this year, for one of my client’s project I’ve been working with OrmLite a lot. Let me expand on those initial lessons and share some others. 1. IgnoreOnUpdate attribute When using SaveAsync() or any update method, OrmLite omits properties marked with the...

TIL: How to join to subqueries with OrmLite
16 Oct 2023 | original ↗

Another day working with OrmLite. This time, I needed to support a report page with a list of dynamic filters and sorting fields. Instead of writing a plain SQL query, I needed to write a SqlExpression that joins to a subquery. OrmLite doesn’t support that. This is what I learned (or hacked) today. Let’s imagine we need to write an SQL query for...

Monday Links: CQRS, Negotiating, and Project Managers
2 Oct 2023 | original ↗

One conference and four articles I found interesting in the last month. CQRS pitfalls and patterns - Udi Dahan I share the points from this presentation about overarchitecting simple applications when there isn’t a compelying reason for that. I’ve witnessed developers and managers using and promoting Domain Driven Design as the golden hammer to...

How to automatically format SQL files with Git and Poor Man's T-SQL Formatter
18 Sept 2023 | original ↗

I believe we shouldn’t discuss formatting and linting during code reviews. That should be automated. With that in mind, these days, I learned how to automatically format SQL files with Git and Poor Man’s T-SQL Formatter for one of my client’s projects. I already shared about two free tools to format SQL files. Poor Man’s T-SQL Formatter is one of...

A business case against massive unrequested refactorings
4 Sept 2023 | original ↗

Blindly following coding principles is a bad idea. “Leave the basecamp cleaner,” “Make the change easy then make the easy change”… Often, we follow those two principles and start huge refactoring sessions with good intentions but without considering the potential consequences. Let me share two stories of refactoring sessions that led to...

There's No Such Thing as Job Security: Three Lessons on Layoffs
21 Aug 2023 | original ↗

I’ve been laid off more than once. I know how it feels. I know that momentary feeling of relief followed by the uncertainty of a “What am I going to do now?” If you haven’t been living under a rock, I bet you have heard the news about layoffs in the tech industry. They’re so common these days that there’s even a page to report and track companies...

Too many layers: My take on Queries and Layers
7 Aug 2023 | original ↗

These days I reviewed a pull request in one of my client’s projects and shared a thought about reading database entities and layering. I believe that project took layering to the extreme. These are my thoughts. For read-only database-access queries, reduce the number of layers in an application to avoid excessive mapping between layers and...

This Is How I'd Start an Ultralearning Project To Become a Software Engineer
24 Jul 2023 | original ↗

Some days ago, I got a message from someone starting his journey to become a Software Engineer. He found my post with the takeaways from the Ultralearning book and asked for feedback. On the email, my reader explained that he wanted to become a professional Software Engineer with a one-year ultralearning project. Also, he wrote he had a list of...

Five years ago, I wrote my first blog post
18 Jul 2023 | original ↗

Some days ago I found out this Hacker News question about what blogging has done for blog writers. I realized that I published my first blog post five years ago. I’d like to share what blogging has done for me. In a past post, I shared how I started blogging and the story behind my first post. Long story short: I didn’t want to throw away some...

Monday Links: NDC Conference
10 Jul 2023 | original ↗

This is another episode where I share the talks from NDC Conference I watched and liked. This time is about JavaScript, History, and Design. How JavaScript Happened: A Short History of Programming Languages - Mark Rendle This is a journey from FORTRAN to ALGOL to LISP to JavaScript. It explains why we still use if for conditional, i for loops,...

TIL: How to pass a DataTable as a parameter with OrmLite
26 Jun 2023 | original ↗

These days I use OrmLite a lot. Almost every single day. In one of my client’s projects, OrmLite is the defacto ORM. Today I needed to pass a list of identifiers as a DataTable to an OrmLite SqlExpression. I didn’t want to write plain old SQL queries and use the embedded Dapper methods inside OrmLite. This is what I found out after a long...

Monday Links: Personal Moats, Unfair Advantage, and Quitting
12 Jun 2023 | original ↗

This is a career-only episode. These are five links I found interesting in the last month. Build Personal Moats From this post, the best career advice is to build a personal moat: “a set of unique and accumulating competitive advantages in the context of your career.” It continues describing good moats and how to find yours. About personal...

Let's refactor a test: Speed up a slow test suite
29 May 2023 | original ↗

Do you have fast unit tests? This is how I speeded up a slow test suite from one of my client’s projects by reducing the delay between retry attempts and initializing slow-to-build dependencies only once. There’s a lesson behind this refactoring session. Make sure to have a fast test suite that every developer could run after every code change....

Let's refactor a test: Update email statuses
15 May 2023 | original ↗

Let’s continue refactoring some tests for an email component. Last time, we refactored two tests that remove duplicated email addresses before sending an email. This time, let’s refactor two more tests. But these ones check that we change an email status once we receive a “webhook” from a third-party email service. Let’s refactor them. Here are...

Monday Links: Interviewing, Zombies, and Burnout
1 May 2023 | original ↗

For this Monday Links, I’d like to share five reads about interviewing, motivation, and career. These are five articles I found interesting in the past month or two. Programming Interviews Turn Normal People into A-Holes This is a good perspective on the hiring process. But from the perspective of someone who was the hiring manager. Two things I...

Goodbye, NullReferenceException: Separate State in Separate Objects
3 Apr 2023 | original ↗

So far in this series about NullReferenceException, we have used nullable operators and C# 8.0 Nullable References to avoid null and learned about the Option type as an alternative to null. Let’s see how to design our classes to avoid null when representing optional values. Instead of writing a large class with methods that expect some nullable...

Goodbye, NullReferenceException: Option and LINQ
20 Mar 2023 | original ↗

In the previous post of this series, we covered three C# operators to simplify null checks and C# 8.0 Nullable References to signal when things can be null. In this post, let’s learn a more “functional” approach to removing null and how to use it to avoid null when working with LINQ XOrDefault methods. 1. Use Option: A More Functional Approach to...

Goodbye, NullReferenceException: Nullable Operators and References
6 Mar 2023 | original ↗

In the previous post of this series, we covered two ideas to avoid the NullReferenceException: we should check for null before accessing the members of an object and check the input parameters of our methods. Let’s see some new C# operators to simplify null checking and a new feature to better signal possible null references. 1. C# Nullable...

Goodbye, NullReferenceException: What it is and how to avoid it
20 Feb 2023 | original ↗

This exception doesn’t need an introduction. I bet you already have found the exception message: “Object reference not set to an instance of an object.” In this series of posts, let’s see some techniques to completely eliminate the NullReferenceException from our code. In this post, let’s see when NullReferenceException is thrown and a strategy...

Monday Links: Monday Links: Passions, Estimates, and Methodologies
23 Jan 2023 | original ↗

Welcome to the first Monday Links of 2023. These are five reads I found interesting last month. This time, I found software methodologies was a recurring theme these days. Why I’m Glad I Lack Passion to BE a Programmer After a couple of years of working as a software engineer, I started to embrace simplicity. Software exists to satisfy a business...

Best of 2022
9 Jan 2023 | original ↗

In 2022, I wrote two major series of posts: one about SQL Server performance tuning and another one about LINQ. Once one of my clients asked me to “tune” some stored procedures and that inspired me to take a close look at the performance tuning world. Last year, I took Brent Ozar Mastering courses and decided to share some of the things I...

Let's refactor a test: Remove duplicated emails
22 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. Recently, I’ve been reviewing pull requests as one of my main activities. This time, let’s refactor two tests I found on one code review session. The two tests check if an email doesn’t have duplicated addresses before sending it. But, they have a common mistake: testing private methods directly. Let’s...

To Value Object or Not To: How I choose Value Objects
21 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. Today I reviewed a pull request and had a conversation about when to use Value Objects instead of primitive values. This is the code that started the conversation and my rationale to promote a primitive value to a Value Object. Prefer Value Objects to encapsulate validations or custom methods on a...

Dump and Load to squash old migrations
20 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. Recently, I stumbled upon the article Get Rid of Your Old Database Migrations. The author shows how Clojure, Ruby, and Django use the “Dump and Load” approach to compact or squash old migrations. This is how I implemented the “Dump and Load” approach in one of my client’s projects. 1. Export database...

Lessons I learned as a code reviewer
19 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. In the past month, for one of my clients, I became a default reviewer. I had the chance to check everybody else’s code and advocate for change. After dozens of Pull Requests (PRs) reviewed, these are the lessons I learned. I’ve noticed that most of the comments fall into two categories. I will call...

Lessons I learned from my ex-coworkers about software engineering
18 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. For better or worse, we all have something to learn from our bosses and co-workers. These are three lessons I learned from three of my ex-coworkers and ex-bosses about software engineering, designing, and programming. I didn’t take the time to thank them when I worked with them. This is my thank you...

Three Postmortem Lessons From a "Failed" Project
17 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. Software projects don’t fail because of the tech stack, programming languages, or frameworks. Sure, choosing the right tech stack is critical for the success of a software project. But software projects fail due to unclear expectations and communication issues. Even unclear expectations are a...

Six helpful extension methods I use to work with Collections
16 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. LINQ is the perfect way to work with collections. It’s declarative and immutable. But, from time to time, I take some extension methods with me to the projects I work with. These are some extension methods to work with collections. 1. Check if a collection is null or empty These are three methods to...

How to create ASP.NET Core Api project structure with dotnet cli
15 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. While looking at C# Advent 2022, I found the Humble Toolsmith page and its post Create Test Solutions by Scripting the Dotnet CLI. That post reminded me I have my own script to create the folder structure for ASP.NET Core API projects. Currently, I work with a client where I have to engage in short...

How to write good unit tests: Use simple test values
14 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. These days I had to review some code that had one method to merge dictionaries. This is one of the suggestions I gave during that review to write good unit tests. To write good unit tests, write the Arrange part of tests using the simplest test values that exercise the scenario under test. Avoid...

TIL: Five or more lessons I learned after working with Hangfire and OrmLite
13 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. These days I finished another internal project while working with one of my clients. I worked to connect a Property Management System with a third-party Point of Sales. I had to work with Hangfire and OrmLite. I used Hangfire to replace ASP.NET BackgroundServices. Today I want to share some of the...

Four Lessons I Wished I Knew Before Becoming a Software Engineer
12 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. It has been more than 10 years since I started working as a Software Engineer. I began designing reports by hand using iTextSharp. And by hand, I mean drawing lines and pixels on a blank canvas. Arrggg! I used Visual Studio 2010 and learned about LINQ for the first time those days. Then I moved to some...

TIL: How to automatically insert and update audit fields with OrmLite
11 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. These days I had to work with OrmLite. I had to follow the convention of adding audit fields in all of the database tables. Instead of adding them manually, I wanted to populate them when using OrmLite SaveAsync() method. This is how to automatically insert and update audit fields with OrmLite. 1....

TIL: How to replace keywords in a file name and content with Bash
10 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. These days I needed to rename all occurrences of one keyword with another in source files and file names. In one of my client’s projects, I had to query one microservice to list a type of account to store it in an intermediate database. After a change in requirements, I had to query for another type of...

TIL: How to rename Visual Studio projects and folders with Git
9 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. These days I had to rename all the projects inside a Visual Studio solution and the folders containing them. From SomeThing.Core to Something.Core. That wasn’t the exact typo. But that’s the idea. Here it’s what I learned. It wasn’t as easy as only renaming the projects in Visual Studio. 1. Rename...

Let's refactor a test: Store and Update OAuth connections
8 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. Last time, in the Unit Testing 101 series, we refactored a unit test for a method that fed a report of transactions in a payment system. This time, let’s refactor another test. This test is based on a real test I had to refactor in one of my client’s projects. Before looking at our test, a bit of...

I'm banning Get, Set, and other method and class names
7 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. Names are important in programming. Good names could be the difference between a developer nodding his head in agreement or making funny faces in a “Wait, whaaaat?” moment. Names are so important that the Clean Code and The Art of Readable Code devote entire chapters to the subject. These are some...

How to replace BackgroundServices with a lite Hangfire
6 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. I like ASP.NET Core BackgroundServices. I’ve used them in one of my client’s projects to run recurring operations outside the main ASP.NET Core API site. Even for small one-time operations, I’ve run them in the same API site. There’s one catch. We have to write our own retrying, multi-threading, and...

I don't use 'Pushy' questions in code reviews anymore. This is what I do instead
5 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. “Ask questions” is common advice for better code reviews. At some point, we followed that advice and started using what I call “leading” or “pushy” questions. Questions that only hint a request for a code change. After working on a remote software team for a couple years, I stopped using “pushy”...

On Unit Testing Logging Messages
4 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. These days I had to review some code that expected a controller to log the exceptions thrown in a service. This is how that controller looked and what I learned about testing logging messages. When writing unit tests for logging, assert that actual log messages contain keywords like identifiers or...

TIL: How to test an ASP.NET Authorization Filter
3 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. These days I needed to work with a microservice for one of my clients. In that microservice, instead of validating incoming requests with the built-in model validations or FluentValidation, they use authorization filters. I needed to write some tests for that filter. This is what I learned. Apart from...

TIL: Always check for missing configuration values inside constructors
2 Dec 2022 | original ↗

This post is part of my Advent of Code 2022. This is a lesson I learned after trying to use a shared NuGet package in one of my client’s projects and getting an ArgumentNullException. I had no clue that I needed some configuration values in my appsettings.json file. This is what I learned. Always check for missing configuration values inside...

Advent of Code 2022
1 Dec 2022 | original ↗

This year, inspired by C# Advent and 24 Pull Requests, I decided to do my own Christmas challenge: my own Advent of Code. I prefer to call it: Advent of Posts. Starting on December 1st, I’m publishing 24 posts, one post per day. The challenge is to write an article per day in about 2 hours, including proof-reading and banner design. I’ve written...

How to write tests for HttpClient using Moq
1 Dec 2022 | original ↗

This post is part of my Advent of Code. These days I needed to unit test a service that used the built-in HttpClient. It wasn’t as easy as creating a fake for HttpClient. This is how to write tests for HttpClient with Moq and a set of extension methods to make it easier. To write tests for a service that requires a HttpClient, create a fake for...

Monday Links: 40-year Programmer, Work and Burnout
21 Nov 2022 | original ↗

Another five interesting links I found in past weeks. This time, I found a recurring theme while reading Hacker News: burnout, caring and statisfaction. The Forty-Year Programmer This post contains all the insights of 40-years a lifetime working as a programmer. These are some of my favorites: “Advice is expertise with all the most important...

Unit Testing Principles, Practices, and Patterns: Takeaways
17 Oct 2022 | original ↗

This book won’t teach you how to write a unit test step by step. But, it will teach you how unit testing fits the larger picture of a software project. Also, this book shows how to write integration tests and test the database. These are my takeaways. 1. What is a unit test? “The goal of unit testing is to enable sustainable growth of the...

Hands-on Domain-Driven Design with .NET Core: Takeaways
3 Oct 2022 | original ↗

If you’re new to Domain-Driven Design, this book is a good starting point. It’s a “hands-on” book. It walks through a sample marketplace for ads. It shows from what Domain-Driven Design is to how to evolve a system. Also, it contains a couple of chapters with a good introduction to Event Sourcing. These are my takeaways. DDD and Ubiquitous...

Monday Links: Time zones and NDC Conference
5 Sept 2022 | original ↗

Last month I followed the NDC Conference on YouTube. In this Monday Links episode, I share some of the conferences I watched and liked. I don’t know why but I watched presentations about failures, aviation disasters, and software mistakes. Well, two of the 5 links aren’t about that. Enjoy! Improve working across time zones Prefer document-based...

Three set-like LINQ methods: Intersect, Union, and Except
22 Aug 2022 | original ↗

So far we have covered some of the most common LINQ methods. This time let’s cover three LINQ methods that work like set operations: Intersect, Union, and Except. Like the Aggregate method, we don’t use these methods every day, but they will come in handy from time to time. 1. Intersect Intersect() finds the common elements between two...

NCache & Full-Text Search
8 Aug 2022 | original ↗

I bet you have used the SQL LIKE operator to find a keyword in a text field. For large amounts of text, that would be slow. Let’s learn how to implement a full-text search with Lucene and NCache. What is Full-Text Search? Full-text search is a technique to search not only exact matches of a keyword in some text but for patterns of text, synonyms,...

Monday Links: Storytelling, Leet Code and Boredom
1 Aug 2022 | original ↗

In case you find the Monday Links series for the first time: these are five links from past weeks that I found interesting (and worth sharing) while procastinating surfing the Web. This is not a link-building scheme, I only read and liked these articles. The Secret Art of Storytelling in Programming by Yehonathan Sharvit This presentation starts...

LINQ Aggregate Method Explained with Pictures
25 Jul 2022 | original ↗

This is not one of the most used LINQ methods. We won’t use it every day. But, it’s handy for some scenarios. Let’s learn how to use the Aggregate method. The Aggregate method applies a function on a collection carrying the result to the next element. It “aggregates” the result of a function over a collection. The Aggregate method takes two...

Peeking into LINQ DistinctBy source code
11 Jul 2022 | original ↗

“Don’t use libraries you can’t read their source code.” That’s a bold statement I found and shared in a past Monday Links episode. Inspired by that, let’s see what’s inside the new LINQ DistinctyBy method. What DistinctBy does DistinctBy returns the objects containing unique values based on one of their properties. It works on collections of...

Four new LINQ methods in .NET 6: Chunk, DistinctBy, Take, XOrDefault
27 Jun 2022 | original ↗

LINQ isn’t a new feature in the C# language. It was released back in C# version 3.0 in the early 2000s. And, after more than ten years, it was finally updated with the .NET 6 release. These are four of the new LINQ methods and overloads in .NET 6. .NET 6 introduced new LINQ methods like Chunk, DistinctBy, MinBy, and MaxBy. Also, new overloads to...

Five common LINQ mistakes and how to fix them
13 Jun 2022 | original ↗

It’s easy to start working with LINQ to replace for, foreach, and other loops. With a handful of LINQ methods, we have our backs covered. But, often, we make some common mistakes when working with LINQ. Here are five common mistakes we make when working with LINQ for the first time and how to fix them. Mistake 1: Use Count instead of Any We...

How to use LINQ GroupBy method: Two more use cases
30 May 2022 | original ↗

Last time, I showed five of the most common LINQ methods with pictures. Let’s take a deeper look at one of them: GroupBy. The GroupBy method groups the elements of a collection based on a grouping key. This method returns a collection of “groups” or “buckets” organized by that key. Let’s continue to work with our catalog of movies and group our...

Monday Links: Staging, Work, and Types
23 May 2022 | original ↗

A career-ending mistake Jumping from place to place until we retire? Hopefully, with good pay raises? Being in a team closing Jira tickets and issues until we get bored? Based on the article, the biggest mistake is “not planning the end of our careers.” The right time to decide the end of our careers is now. The article shows three career...

Five LINQ Methods in Pictures
16 May 2022 | original ↗

If you’re learning LINQ for the first time, it can be daunting to learn all LINQ methods at once. Don’t try it. Here are the five most common LINQ methods in pictures. LINQ is the declarative, immutable, and lazy-evaluated way of working with collections in C#. And the most frequently used LINQ methods are Where, Select, Any, GroupBy, and...

Brent Ozar’s Mastering Courses: My Honest Review
2 May 2022 | original ↗

This is an honest review of Brent Ozar’s Mastering courses after finishing them all some months ago. I couldn’t write this a couple of years ago. Working with databases was a subject I avoided at all costs. Even to the point where I traded database-related tasks with an ex-coworker at a past job. Avoiding database concepts cost me painful...

Monday Links: Blog, Error Messages and Recruiters
25 Apr 2022 | original ↗

Toxic Culture Is Driving the Great Resignation I have read a couple of times about the Great Resignation. I guess the world isn’t the place after the pandemic. And that is reflected in the job market too. “A toxic corporate culture is the single best predictor of which companies suffered from high attrition in the first six months of the Great...

BugOfTheDay: Object definitions, spaces, and checksums
18 Apr 2022 | original ↗

These days I was working with a database migration tool and ended up spending almost a day figuring out why my migration didn’t work. This is what I learned after debugging an issue for almost an entire day. In one of my client’s projects to create or update stored procedures, we use a custom migrator tool, a wrapper on top of DbUp, “a set of...

Working with ASP.NET Core IDistributedCache Provider for NCache
11 Apr 2022 | original ↗

As we learned last time, when I covered in-memory caching with ASP.NET Core, a cache is a storage layer between an application and an external resource (a database, for example) used to speed up future requests to that resource. In this post, let’s use ASP.NET Core IDistributedCache abstractions to write a data caching layer using NCache. 1....

TIL: T-SQL doesn't have constants and variables aren't a good idea
4 Apr 2022 | original ↗

Today I learned how to use constants in SQL Server stored procedures. While getting a stored procedure reviewed, I got one comment to remove literal values. This is how to bring constants in T-SQL. SQL Server doesn’t have a keyword for constants. To introduce constants in stored procedures, write literal values next to an explaining comment or...

SQL Server Index recommendations: Just listen to them
21 Mar 2022 | original ↗

I guess you have seen SQL Server index recommendations on actual execution plans. But, you shouldn’t take them too seriously. This is what I learned about SQL Server index recommendations. SQL Server builds index recommendations based on the WHERE and SELECT clauses of a query, without considering GROUP BY or ORDER BY clauses. Use index...

Monday Links: Going solo, making friends and AutoMapper
14 Mar 2022 | original ↗

11 things I wish I knew before I went Independent A good read for all of us wanting to go solo. The author answers the question: “how you made the decision to go independent and how you got started?”. Among other things: find a niche, learn about sales and marketing, and talk to your customers… Definitively we don’t have to be the “I do anything...

TIL: How to optimize Group by queries in SQL Server
7 Mar 2022 | original ↗

Let me share this technique I learned to improve queries with GROUP BY in SQL Server. To improve queries with GROUP BY, write the SELECT query with the GROUP BY part using only the needed columns to do the grouping or sorting inside a common table expression (CTE) first. Then, join the CTE with the right tables to find other columns. Usual GROUP...

TIL: How to do a case-sensitive search in SQL Server
21 Feb 2022 | original ↗

Do you use LOWER or UPPER to do case-sensitive searches? Let’s see how to write a case-sensitive search in SQL Server. To write a case-sensitive search in SQL Server, don’t use UPPER or LOWER functions around the column to filter. Instead, use the COLLATE keyword with a case-sensitive collation followed by the comparison. Naive case sensitive...

Monday Links: Daily Meetings, Estimates, and Challenges
14 Feb 2022 | original ↗

This Monday Links episode is about careers and developer life. Four reads. Let’s start with a rant on daily meetings. Enjoy! Daily Standup Meetings are useless I think I could have written this article myself. I’ve been in those daily meetings you want to finish as quickly as possible to get back to your life. -“I’m working on ABC, no blockers.”...

What are implicit conversions and why you should care
7 Feb 2022 | original ↗

SQL Server compares columns and parameters with the same data types. But, if the two data types are different, weird things happen. Let’s see what implicit conversions are and why we should care. An implicit conversion happens when the data types of columns and parameters in comparisons are different. And SQL Server has to convert between them,...

Don't use functions around columns in your WHEREs: The worst T-SQL mistake
24 Jan 2022 | original ↗

There’s one thing we could do to write faster queries in SQL Server: don’t use functions around columns in WHERE clauses. I learned it the hard way. Let me share this lesson with you. Don’t use user-defined or built-in functions around columns in the WHERE clause of queries. It prevents SQL Server from estimating the right amount of rows out of...

Monday Links: Better programming, flags, and C#
17 Jan 2022 | original ↗

This episode of Monday Link is a bit diverse. From getting better at programming to why it’s harder for juniors to get hired. And, a rant about the C# evolution. I couldn’t avoid adding the last article to this Monday Links. I try to only share five articles. But, that’s a great story of establishing priorities and putting life, health, and work...

Best of 2021
10 Jan 2022 | original ↗

In 2021, I switched from posting whenever I had an idea about anything to posting regularly every other week about some topics. I wrote a whole series of posts about unit testing. From how to write your first unit test with MSTest to what stubs and mocks are. In fact, I wrote my first ebook Unit Testing 101 with some of the posts of the series....

The Art of Readable Code: Takeaways
20 Dec 2021 | original ↗

The Art of Readable Code is the perfect companion for the Clean Code. It contains simple and practical tips to improve your code at the function level. It isn’t as dogmatic as Clean Code. Tips aren’t as strict as the ones from Clean Code. But, it still deserves to be read. These are some of my notes on The Art of Readable Code. 1. Code should be...

Domain Modeling Made Functional: Takeaways
13 Dec 2021 | original ↗

If you are curious about the functional world, but you found it too hard to start, this book is a good place to start. These are my notes and takeaways from “Domain Modeling Made Functional” by Scott Wlaschin. “Domain modeling made functional” teaches to start coding only after understanding the domain. And to capture requirements, constraints,...

It's not what you read, it's what you ignore
6 Dec 2021 | original ↗

A long time ago, I watched an online presentation by Scott Hanselman (@shanselman) about productivity. One of the best I’ve seen. These days I found my handwritten notes about it. Today, I want to share my takeaways and the tools I’ve used since I watched it the first time. Triage every inbox Do triage the same way doctors do it. Set three goals...

Want to ace your next take-home coding exercises? Follow these 13 short tips
22 Nov 2021 | original ↗

Take-home coding exercises aren’t rare in interviews. I’ve found from 4-hour exercises to 2-day exercises to a Pull Request in an open-source project. Even though, in my CV I have links to my GitHub profile (with some green squares, not just cricket sounds) and my personal blog (the one you’re reading), I’ve had to finish take-home exercises....

BugOfTheDay: There are pending requests working on this transaction
8 Nov 2021 | original ↗

These days I got this exception message: “The transaction operation cannot be performed because there are pending requests working on this transaction.” This is how I fixed it after almost a whole day of Googling and debugging. To fix the “pending requests” exception, make sure to properly await all asynchronous methods wrapped inside any...

Monday Links: Workplaces, studying and communication
1 Nov 2021 | original ↗

Another Monday Links. Five articles I found interesting in last month. Don’t waste time on heroic death marches “Successful companies, whether they’re programming houses, retailers, law firms, whatever, make their employees’ needs a priority.” Totally agree. No more comments! Read full article How to study effectively One of my favorite subjects:...

TIL: Dictionary keys are converted to lowercase too on serialization
25 Oct 2021 | original ↗

Today, I needed to pass a dictionary between two ASP.NET Core 6.0 API sites. To my surprise, on the receiving side, I got the dictionary with all its keys converted to lowercase instead of PascalCase. I couldn’t find any element on the dictionary, even though the keys had the same names on each API site. This is what I learned about serializing...

Don't duplicate logic in Asserts: The most common mistake on unit testing
11 Oct 2021 | original ↗

We have covered some common mistakes when writing unit tests. Some of them may seem obvious. But, we all have made this mistake when we started to write unit tests. This is the most common mistake when writing unit tests and how to fix it. Don’t repeat the logic under test when verifying the expected result of tests. Instead, use known,...

Two C# idioms: On defaults and switch
27 Sept 2021 | original ↗

In this part of the C# idioms series, we have one idiom to write more intention-revealing defaults and another idiom to convert mapping code using a switch to a more compact alternative using a dictionary. Use intention-revealing defaults When initializing variables to default values, use intention-revealing alternatives. Are you initializing a...

My Top 16 newest C# features by version
13 Sept 2021 | original ↗

C# is a language in constant evolution. It has changed a lot since its initial versions in the early 2000’s. Every version brings new features to write more concise and readable code. These are some C# features I like the most and use often. Hope you find them useful too. Let’s start with the best C# features by version, starting from version 6....

Monday Links: Farmers, Incidents & Holmes
6 Sept 2021 | original ↗

Today I want to start a new series: Monday Links. I want to share interesting and worth-sharing blog posts, articles or anything I read online in the last month or two. You may find them interesting and instructive too. Farmers always Worked From Home We’re in the work-from-home era. But, farmers have always worked from home. This article states...

Unit Testing 101: From Zero to Hero
30 Aug 2021 | original ↗

Do you want to start writing unit tests? But, you don’t know where to start? Do you want to adopt unit testing in your team? I can help you! If you’re a beginner or a seasoned developer new to unit testing, this is the place for you. No prerequisites are needed. Write it Learn to write your first unit tests with MSTest. Read what a unit test is,...

Write custom Assertions to improve your tests
16 Aug 2021 | original ↗

Last time, we went through some best practices to write better assertions on our tests. This time, let’s focus on how to use custom assertions to improve the readability of our tests. Use custom assertions to encapsulate multiple assertions on a single method and express them in the same language as the domain model. Write custom assertions with...

Let's refactor a test: Payment report
2 Aug 2021 | original ↗

Let’s refactor a test to follow our unit testing best practices. This test is based on a real test I had to modify in one of my client’s projects. Imagine this test belongs to a payment gateway. The system takes payments on behalf of partners. At the end of every month, the partners get the collected payments discounting any fees. This process is...

How to write better assertions in your tests
19 Jul 2021 | original ↗

There’s a lot to say about how to write good unit tests. This time, let’s focus on best practices to write better assertions on our tests. Here you have 5 tips to write better assertions on your unit tests. TL;DR Follow the Arrange/Act/Assert (AAA) pattern Separate each A of the AAA pattern with line breaks Don’t put logic in...

Unit Testing Best Practices: A checklist
5 Jul 2021 | original ↗

As part of this series on unit testing, we’ve covered a lot of subjects. From how to write your first unit tests to create test data with Builders to how to write better fakes. I hope I’ve helped you to start writing unit tests or write even better unit tests. This time, I’m bringing some tips and best practices from my previous posts in one...

Write simpler tests with Type Builders and AutoFixture
21 Jun 2021 | original ↗

Writing tests for services with lots of collaborators can be tedious. I know! We will end up with complex Arrange parts and lots of fakes. Let’s see three alternatives to write simpler tests with builder methods, Type Builders and AutoFixture. To write simpler tests for services with lots of collaborators, use builder methods to create only the...

Five tips for better stubs and mocks in C#
7 Jun 2021 | original ↗

Last time, we covered what fakes are in unit testing and the types of fakes. We wrote two tests for an OrderService to show the difference between stubs and mocks. In case you missed it, fakes are like test “simulators.” They replace external dependencies with testable components. Stubs and mocks are two types of fakes. Stubs are “simulators”...

What are fakes in unit testing? Mocks vs Stubs
24 May 2021 | original ↗

Do you know what are fakes? Are stubs and mocks the same thing? Do you know if you need any of them? Once I made the exact same questions. Let’s see what are fakes in unit testing. In unit testing, fakes or test doubles are classes or components that replace external dependencies. Fakes simulate successful or failed scenarios to test the logic...

How to write tests that use DateTime.Now
10 May 2021 | original ↗

In our last post about using builders to create test data, we wrote a validator for expired credit cards. We used DateTime.Now all over the place. Let’s see how to write better unit tests that use the current time. To write tests that use DateTime.Now, create a wrapper for DateTime.Now and use a fake or test double with a fixed date. As an...

How to create test data with the Builder pattern
26 Apr 2021 | original ↗

Last time, we learned how to write good unit tests by reducing noise inside our tests. We used a factory method to simplify complex setup scenarios in our tests. Let’s use the Builder pattern to create test data for our unit tests. With the Builder pattern, an object creates another object. A builder has methods to change the state of an object...

How to name your unit tests: Four test naming conventions
12 Apr 2021 | original ↗

From our previous post, we learned about four common mistakes we make when writing our first unit tests. One of them is not to follow a naming convention. Let’s see four naming conventions for our unit tests. Test names should tell the scenario under test and the expected result. Writing long names is acceptable since test names should show the...

Four common mistakes when writing your first unit tests
29 Mar 2021 | original ↗

Last time, we covered how to write our first unit tests with C# and MSTest. We started from a Console program and converted it into our first unit tests. We wrote those tests for Stringie, a (fictional) library to manipulate strings with more readable methods. This time, we will cover how NOT to write unit tests. These are four common mistakes we...

Unit Testing 101: Write your first unit test in C# with MSTest
15 Mar 2021 | original ↗

Do you want to start writing unit tests and you don’t know how to start? Were you asked to write some unit tests on a past interview? Let’s see what a unit test is and how to write your first unit tests in C#. 1. What is a Unit test? The book The Art of Unit Testing defines a unit test as “an automated piece of code that invokes a unit of work in...

How not to write Dynamic SQL
8 Mar 2021 | original ↗

Last time, I showed you three tips to debug your Dynamic SQL. Let’s take a step back. Let’s see what is a dynamic SQL query and how to use one to rewrite a stored procedure with optional parameters. Dynamic SQL is a string with a query to execute. In a stored procedure with optional parameters, Dynamic SQL is used to build a string containing a...

TIL: How to convert 2-digit year to 4-digit year in C#
24 Feb 2021 | original ↗

Today I was working with credit cards and I needed to convert a 2-digit year to a 4-digit one in C#. The first thing that came to my mind was adding 2000 to it. But it didn’t feel right. It wouldn’t be a problem in hundreds of years, though. To convert 2-digit year into a 4-digit year, use the ToFourDigitYear method inside your current culture’s ...

Visual Studio snippets for Moq
22 Feb 2021 | original ↗

These days, I use Moq a lot. There are things I like and I don’t like about creating fakes with Moq. But it’s simple and easy to use. I use the same four Moq methods all the time. Setup, ReturnAsync, ThrowsAsync and Verify. That’s all you need. I decided to create snippets inside Visual Studio to avoid typing the same method names every time....

Decorator pattern. A real example in C#
10 Feb 2021 | original ↗

I’ve been working with Stripe to take payments. Depending on the volume of requests you make to the Stripe API, you might exceed the maximum number of requests per second. This is how we can implement a retry mechanism using the Decorator pattern in C#. A Decorator wraps another object to extend its responsabilities, without modifying its...

How to write good unit tests: Write failing tests first
5 Feb 2021 | original ↗

A passing test isn’t always the only thing to look for. It’s important to see our test failing. I learned this lesson the hard way. Let’s see why we should start writing failing tests. To write reliable unit tests, always start writing a failing test. And make sure it fails for the right reasons. Follow the Red, Green, Refactor principle of...

TIL: Livable Code. Living with your mess
25 Jan 2021 | original ↗

These days, I watched a conference online by Sarah Mei (@sarahmei) titled: Livable Code. This is what livable code is. Livable Code is the analogy that building software is like living an space inside a building instead of constructing a house or a building. Building software isn’t like building anything else. It isn’t like planning, constructing...

A quick guide to LINQ with examples
18 Jan 2021 | original ↗

Today a friend asked me about LINQ. She was studying for a technical interview. So, dear Alice: This is what LINQ is and these are the most common LINQ methods with examples. All you need to know about LINQ in 15 minutes or less. Language-Integrated Query (LINQ) is the declarative way of working with collections in C#. LINQ works with databases...

TIL: Three differences between TRUNCATE and DELETE
4 Jan 2021 | original ↗

Both DELETE and TRUNCATE remove records from a table. But, these days I learned three differences between TRUNCATE and DELETE statements in SQL Server. Let me share them with you. DELETE accepts a WHERE condition to only remove some records, TRUNCATE doesn’t. DELETE doesn’t reset identity columns to its initial value, but TRUNCATE does. And,...

A case of primitive obsession. A real example in C#
10 Dec 2020 | original ↗

These days I was working with Stripe API to take payments. And I found a case of primitive obsession. Keep reading to learn how to get rid of it. Primitive obsession is when developers choose primitive types (strings, integers, decimals) to represent entities of the business domain. To solve this code smell, create classes to model the business...

TIL: Always Use a Culture When Parsing Numeric Strings in C#
4 Dec 2020 | original ↗

This week, I reinstalled the operating system of my computer. The new version uses Spanish instead of English. After that, some unit tests started to break in one of my projects. The broken tests verified the formatting of currencies. This is what I learned about parsing numeric strings and unit testing. To have a set of always-passing unit...

TIL: Three Tricks to Debug Your Dynamic SQL Queries
3 Dec 2020 | original ↗

These three tips will help you to troubleshoot your dynamic queries and identify the source of a dynamic query when you find one in your query store or plan cache. To make dynamic SQL queries easier to debug, format the generated query with line breaks, add as a comment the name of the source stored procedure and use a parameter to only print the...

How to Take Smart Notes. Takeaways
18 Nov 2020 | original ↗

“How to Take Smart Notes” describes the Zettelkasten method in depth. It shows how scientists and writers can produce new content from their notes. But, you don’t have to be a scientist to take advantage of this method. Anyone can use it to organize his knowledge. The Zettelkasten method is the secret behind Niklas Luhman’s success. He was a...

TIL: LINQ DefaultIfEmpty method in C#
17 Nov 2020 | original ↗

Today I was reading the AutoFixture source code in GitHub and I found a LINQ method I didn’t know about: DefaultIfEmpty. DefaultIfEmpty returns a collection containing a single element if the source collection is empty. Otherwise, it returns the same source collection. For example, let’s find all the movies with a rating greater than 9....

TIL: SQL Server uses all available memory
13 Nov 2020 | original ↗

SQL Server tries to use all available memory. SQL Server allocates memory during its activity. And, it only releases it when Windows asks for it. This is normal behavior. SQL Server caches data into memory to reduce access to disk. Remember, SQL Server caches data pages, not query results. You can limit the amount of memory available by setting...

How to write good unit tests: Noise and Hidden Test Values
2 Nov 2020 | original ↗

These days, I needed to update some unit tests. I found two types of issues with them. Please, continue to read. Maybe, you’re a victim of those issues, too. Let’s learn how to write good unit tests. To write good unit tests, avoid complex setup scenarios and hidden test values. Often tests are bloated with unneeded or complex code in the Arrange...

Let's React. Learn React in 30 days
26 Oct 2020 | original ↗

Do you want to learn React and you don’t where to start? Don’t look for any other curated list of resources. Let’s learn React in 30 days! React is a JavaScript library to build user interfaces. It doesn’t do a lot of things. It renders elements on the screen. Period! React isn’t a Swiss-army knife framework full of functionalities. To learn...

Three Language Lessons I Learned on my First Visit to France
23 Oct 2020 | original ↗

This post is about one of my hobbies: learning new languages. But not programming languages. Foreign languages. I want to share three lessons I learned while traveling to France to practice my French-speaking skills. Each lesson is behind a funny story that happened on my first visit to France. Photo by Byeong woo Kang on Unsplash These are the...

TIL: NULL isn't LIKE anything else in SQL Server
20 Oct 2020 | original ↗

How does the LIKE operator handle NULL values of a column? Let’s see what SQL Server does when using LIKE with a nullable column. When using the LIKE operator on a nullable column, SQL Server doesn’t include in the results rows with NULL values in that column. The same is true, when using NOT LIKE in a WHERE clause. Let’s see an example. Let’s...

BugOfTheDay: How I tuned a procedure to find reservations
14 Oct 2020 | original ↗

This time, one of the searching features for reservations was timing out. The appropiate store procedure took ~5 minutes to finish. This is how I tuned it. To tune a store procedure, start by looking for expensive operators in its Actual Execution plan. Reduce the number of joining tables and stay away from common bad practices like putting...

TIL: EXISTS SELECT 1 vs EXISTS SELECT * in SQL Server
8 Oct 2020 | original ↗

EXISTS is a logical operator that checks if a subquery returns any rows. EXISTS works only with SELECT statements inside the subquery. Let’s see if there are any differences between EXISTS with SELECT * and SELECT 1. There is no difference between EXISTS with SELECT * and SELECT 1. SQL Server generates similar execution plans in both scenarios....

TIL: How to compare DateTime without the time part in SQL Server
5 Oct 2020 | original ↗

If you use DATEDIFF() or CAST() to filter a table by a DATETIME column using only the date part, there’s a better way. Let’s find it out. To compare dates without the time part, don’t use the DATEDIFF() or any other function on both sides of the comparison in a WHERE clause. Instead, put CAST() on the parameter and compare using >= and . Let’s...

TIL: How to add gzip compression to ASP.NET Core API responses
1 Oct 2020 | original ↗

Today, I got the report that one API endpoint took minutes to respond. It turned out that it returned hundreds of large complex objects. Those objects contained branding colors, copy text, and hotel configurations in a reservation system. This is how to add response compression in ASP.NET Core 6.0. To compress responses with ASP.NET Core,...

Show your work. Takeaways
1 Oct 2020 | original ↗

Show your work is a New York Times bestseller by Austin Kleon. He describes his book as “a book for people who hate the very idea of self-promotion”. This book tells you how and why you should show your work online. These are my takeaways. “Show your work” teaches that your work has to be out there. And, if your work isn’t online, it doesn’t...

Two free tools to format SQL queries
30 Sept 2020 | original ↗

Do you need to format your SQL queries? Are you doing it by hand? Stop! There is a better way! Instead of formatting SQL queries to follow code conventions by hand, we can use online tools or extensions inside Visual Studio, SQL Server Management Studio, or any other text editor. These are two free tools to format SQL queries and store...

Six SQL Server performance tuning tips from Pinal Dave
28 Sept 2020 | original ↗

Recently, I’ve needed to optimize some SQL Server queries. I decided to look out there what to do to tune SQL Server and SQL queries. This is what I found. At the database level, turn on automatic update of statistics, increase the file size autogrowth and update the compatibility level. At the table level, delete unused indexes and create the...

BugOfTheDay: The slow room search
23 Sept 2020 | original ↗

Another day at work! This time, the room search was running slow. For one of the big hotels, searching all available rooms in a week took about 15 seconds. This is how I optimized the room search functionality. This room search was a public page to book a room into a hotel without using any external booking system. This page was like a custom...

In case of emergency, break the glass. Three debugging tips
19 Sept 2020 | original ↗

What do you do when you’re facing a problem or have to fix a bug? Bang your head against the wall, smash your display? Here you have three debugging tips. 1. Isolate your problem A coworker always says “Isolate your problem!” when you ask him for help. He’s right! Start by removing all irrelevant parts from your problem. Is the problem in your...

Just Vim It! Learning Vim For Fun and Profit
14 Sept 2020 | original ↗

Have you ever heard about Vim? You might know it only as the text editor you can’t even close if you don’t know a key combination. But, once you know Vim, you can edit text files at the speed of light. Let’s see why you should learn it and how to start using it! What is Vim? From Vim’s official page, Vim “…is a highly configurable text editor...

How I got rid of two recurring review comments (Git hook, VS extension)
2 Sept 2020 | original ↗

These are two things I always forgot to do when opening my code to code review. To save my reviewers and me some time, I decided to do something about it. This is how I get rid of two recurrent comments I got getting my code reviewed. For a project I was working on, I had to include the ticket number in every commit message and add Async suffix...

How I take notes?
29 Aug 2020 | original ↗

Some time ago, I commented on a discussion on dev.to titled How do you make notes?. Here is my long reply. Plain text and Markdown I love plain text. It’s future-proof. I can use any text editor to edit text files. Notepad++, SublimeText, Vim, Visual Studio Code, you name it. I use plain text for almost everything. I write all my notes using...

How to read configuration values in ASP.NET Core
21 Aug 2020 | original ↗

Let’s see how to read and overwrite configuration values with ASP.NET Core 6.0 using the Options pattern. To read configuration values following the Options pattern, add a new section in the appsetttings.json file, create a matching class, and register it into the dependencies container using the Configure() method. Those are Macaroon options....

How to keep your database schema updated with Simple.Migrations
15 Aug 2020 | original ↗

Do you email SQL scripts to a coworker to update your database schema? Do you update your database schema by hand? I’ve being there. Let’s find out about database migrations with Simple.Migrations. A database migration is a uniquely identified operation to create, update or delete database objects. Migrations are a more scalable and maintainable...

How to create fakes with Moq. And what I don't like about it
11 Aug 2020 | original ↗

A recurring task when we write unit tests is creating replacements for collaborators. If we’re writing unit tests for an order delivery system, we don’t want to charge a credit card every time we run our tests. This is how we can create fakes using Moq. Fakes or test doubles are testable replacements for dependencies and external systems. Fakes...

Ten lessons learned after one year of remote work
8 Aug 2020 | original ↗

It’s been a year since I started to work remotely. These are the lessons I learned. For employers, leaders, or managers 1. Give clear instructions State what you expect and when you expect it. Make sure to say the day, time, and timezone, if needed. “Tomorrow morning” is at a different time in different parts of the world. Have in mind that...

Two C# idioms: On Dictionaries
1 Aug 2020 | original ↗

This part of the C# idioms series is only about dictionaries. Let’s get rid of exceptions when working with dictionaries. Instead of checking if a dictionary contains an item before adding it, use TryAdd TryAdd() will return if an item was added or not to the dictionary. Unlike Add(), if the given key is already in the dictionary, TryAdd() won’t...

Another two C# idioms
28 Jul 2020 | original ↗

In this part of the C# idioms series, we have one idiom to organize versions of commands, events or view models. And another idiom, on coditionals inside switch statements. Separate versions of commands and events using namespaces and static classes Sometimes you need to support versions of your objects to add new properties or remove old ones....

Programming Time Capsule
20 Jul 2020 | original ↗

These days, while watching YouTube, I found a Mexican YouTuber explaining what life was like in his city during the 2020 COVID-19 pandemic. I thought it was a good idea to write something similar but for coding. This is an opinionated view of what coding is like in 2020. Software developers from the future, this is programming in 2020. GitHub has...

How I started blogging and why you should start too
18 Jul 2020 | original ↗

Once upon a time, a junior engineer at his first job Everything started with my first professional job. I was a junior software engineer, the least experienced on the team. I had just finished reading The Clean Code. And I wanted to rewrite all the code I had worked with. I had a lot to share with my colleagues about coding. But I was the new...

Ultralearning: Takeaways
14 Jul 2020 | original ↗

Scott Young describes in Ultralearning the strategy behind his own learning challenges, like “MIT Challenge in 1 year” and “A year without English.” Let’s learn what Ultralearning is all about. These are my takeaways. Ultralearning is a self-directed and intense strategy to learn any subject. Ultralearning projects help to advance careers or...

Let's Go: Learn Go in 30 days
5 Jul 2020 | original ↗

Do you want to learn a new programming language but don’t know what language to choose? Have you heard about Go? Well, let’s learn Go in 30 days! From its official page, Go is “an open source programming language that makes it easy to build simple, reliable, and efficient software”. Go is a popular language. According to Stack Overflow Developer...

How to add an in-memory and a Redis-powered cache layer with ASP.NET Core
29 Jun 2020 | original ↗

Let’s say we have a SlowService that calls a microservice and we need to speed it up. Let’s see how to add a caching layer to a service using ASP.NET Core 6.0. A cache is a storage layer used to speed up future requests. Reading from a cache is faster than computing data or retrieving it from an external source on every request. ASP.NET Core has...

The Clean Coder: Three Takeaways
15 Jun 2020 | original ↗

The Clean Coder is the second book on the Clean Code trilogy. It should be a mandatory reading for any professional programmer. These are my main takeaways. The Clean Coder isn’t about programming in itself. It’s about the professional practice of programming. It covers from what is professionalism to testing strategies, pressure and time...

A beginner's Guide to Git. A guide to time travel
29 May 2020 | original ↗

Do you store your files on folders named after the date of your changes? I did it back in school with my class projects. There’s a better way! Let’s use Git and GitHub to version control our projects. $ ls Project-2020-04-01/ Project-Final/ Project-Final-Final/ Project-ThisIsNOTTheFinal/ Project-ThisIsTheTrueFinal/ 1. What is a Version Control...

Pragmatic Thinking and Learning: Three takeaways
7 May 2020 | original ↗

This books sits between learning and programming. It’s like a learning guide for developers. Well, it’s more than that. “Pragmatic Thinking and Learning” starts with an expertise model, moves to an analogy of how the brain works until how to capture new ideas and organize your learning. Since learning is the best skill to have, this book is...

How to create a CRUD API with ASP.NET Core and Insight.Database
1 May 2020 | original ↗

Almost all web applications we write talk to a database. We could write our own database access layer, but we might end up with a lot of boilerplate code. Let’s use Insight.Database to create a CRUD API for a catalog of products with ASP.NET Core. 1. Why to use an ORM? An object-relational mapping (ORM) is a library that converts objects to...

Programs that saved you 100 hours (Online tools, Git aliases and Visual Studio extensions)
13 Apr 2020 | original ↗

Today I saw this Hacker News thread about Programs that saved you 100 hours. I want to show some of the tools that have saved me a lot of time. Probably not 100 hours yet. 1. Online Tools JSON Utils It converts a json file into C# classes. We can generate C# properties with attributes and change their casing. Visual Studio has this feature...

ASP.NET Core Guide for ASP.NET Framework Developers
23 Mar 2020 | original ↗

If you are a C# developer, chances are you have heard about this new .NET Core thing and the new version of the ASP.NET framework. You can continue to work with ASP.NET Web API or any other framework from the old ASP.NET you’ve known for years. But, ASP.NET Core is here to stay. In case you missed it, “ASP.NET Core is a cross-platform,...

The Art of Unit Testing: Takeaways
6 Mar 2020 | original ↗

This is THE book to learn how to write unit tests. It starts from the definition of a unit test to how to implement them in your organization. It covers the subject extensively. “The Art of Unit Testing” teaches us to treat unit tests with the same attention and care we treat production code. For example, we should have test reviews instead of...

Pipeline pattern: An assembly line of steps
14 Feb 2020 | original ↗

You need to do a complex operation made of smaller consecutives tasks. These tasks might change from client to client. This is how you can use the Pipeline pattern to achieve that. Let’s implement the Pipeline pattern in C#. With the Pipeline pattern, a complex task is divided into separated steps. Each step is responsible for a piece of logic of...

Clean Code: Takeaways
6 Jan 2020 | original ↗

Clean Code will change the way you code. It doesn’t teach how to code in a particular language. But, it teaches how to produce code easy to read, grasp and maintain. Although code samples are in Java, all concepts can be translated to other languages. The Clean Code starts defining what it’s clean code by collecting quotes from book authors and...

Tips and Tricks for Better Code Reviews
17 Dec 2019 | original ↗

Are you new to code reviews? Do you know what to look for in a code review? Do you feel frustrated with your code review? I’ve been there too. Let’s see some tips I learned and found to improve our code reviews. Code review is a stage of the software development process where a piece of code is examined to find bugs, security flaws, and other...

Two C# idioms
19 Nov 2019 | original ↗

You have heard about Pythonic code? Languages have an expressive or “native” way of doing things. But, what about C#? Is there C-Sharpic code? In this series of posts, I will attempt to present some idioms or “expressions” to write more expressive C# code. I collected these idioms after reviewing code and getting mine reviewed too. In this first...

Git guide for TFS users
11 Nov 2019 | original ↗

Dear developer, you’re working in a project that uses Team Foundation Server, TFS. You’re used to check-out and check-in your files. Now you have to use Git. Do you know how the two relate to each other? This is what makes TFS and Git different. Team Foundation Server (TFS) and Git belong to two different types of Version Control Systems. TFS is...

Remote interview: Here I go (interview types and tips)
29 Sept 2019 | original ↗

Are you applying for a remote position? For a on-site position but the interviewer is on another branch outside your city? Are preparing yourself for future interviews? Let’s see 4 types of interview and tips to prepare for them. There are four types of interviews you can find while applying for a new job. 1. Conversation In conversational...

How to Shift Array Elements in C# (Space Complexity)
16 Sept 2019 | original ↗

Here you are in another interview. You start to feel confident from your last interview. You have already evaluated postfix expressions and solved the two-number sum problem. Now, the interviewer challenges you with a new exercise: How to shift arrays elements to the right. Let’s solve it. Given an array of integers and an integer k, rotate all...

How to Solve The Two-Sum Problem in C# (Time Complexity)
29 Aug 2019 | original ↗

You nailed it at evaluating postfix expressions. You impressed the interviewer with your solution. Now, you’re asked about the time complexity of finding the sum of two elements in two arrays. Time complexity is a mechanism to compare the performance of two algorithms as the input size grows. Time complexity measures the number of operations...

Five lessons after five years as a software developer
19 Aug 2019 | original ↗

Five years of experience. Two companies. Two roles. These are 5 lessons I learned after my first five years as a software engineer. 1. You are not your code Don’t judge someone by his code. Don’t take it personally. You could miss professional connections or friendships by judging someone by his code. Assume everyone does his best with the...

Postfix Notation: An Interview Exercise
2 Aug 2019 | original ↗

You are applying for your first position or for a new job. You are asked to complete a coding exercise: evaluate an expression in postfix notation. Let’s see what is postfix notation and how to evaluate postfix expressions in C#. What is Postfix Notation? Math and some programming languages use the infix notation. It places the operator between...

Visual Studio 2022 setup for C# (theme, settings, extensions)
28 Jun 2019 | original ↗

Visual Studio is the de facto IDE for C#. You will spend countless hours inside Visual Studio. You are better off spending some time to customize it to boost your productivity. My Visual Studio setup is heavily inspired by De-Cruft Visual Studio. It aims to leave more space to the text editor by removing unneeded menus and bars. These are the...

What the Func, Action? Func vs Action
22 Mar 2019 | original ↗

What’s the difference between Func and Action in C#? This is a common C# interview question. Let’s find it out! The difference between Func and Action is the return type of the method they point to. Action references a method with no return type. And, Func references a method with a return type. What are delegates? It all starts with delegates. A...

Parsinator, a tale of a pdf parser
8 Mar 2019 | original ↗

Imagine one day, your boss asks you to read a pdf file to extract relevant information and build a request for your main API. That happened to me. My first thought was: “how in the world am I going to read the text on the pdf file?” This is how I built Parsinator. Parsinator is a library to turn structured and unstructured text into a...

The C# Definitive Guide
17 Nov 2018 | original ↗

Are you looking for a learning path to be “fluent” in C#? This is the right place for you! This is my definitive guide to what every beginner and intermediate C# developer should know. Every intermediate C# developer should know how to productively work with Visual Studio or Visual Studio Code, use async/await keywords, most common LINQ methods...

How to handle holidays in C# with DateTimeExtensions
22 Oct 2018 | original ↗

Do you need to add only working days to a date in C#? Do you need to check if a date is a holiday? This is how to handle holidays in C# with DateTimeExtensions. Don’t store holidays on the database We could have a table in our database with all the holidays in a year and a SQL query to find the holidays between two dates. But, sooner or later we...

When logging met AOP with Fody
18 Jul 2018 | original ↗

How many times have you had to log the entry and the exit of every single method in a service or in a class? So, your code ends up entangled with lots of Log.XXX lines. Something like this: abstract class Beverage { private int _capacity = 10; public int Drink(int count) { Log.Info($"Init {nameof(Drink)}"); try ...

↑ These items are from RSS. Visit the blog itself at https://canro91.github.io/ to find everything else and to appreciate author's digital home.