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...
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...
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 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...
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 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...
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...
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,...
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...
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...
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...
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...
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...
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...
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...
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...
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 ...
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”...
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...
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...
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....
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, 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 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,...
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...
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...
“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...
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...
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...
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...
“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...
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...
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...
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...
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...
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...
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...
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...
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...
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?...
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...
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...
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...
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,...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
#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...
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...
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...
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...
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...
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....
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....
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...
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....
“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...
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...
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...
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...
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 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...
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...
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...
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...
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 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...
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...
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...
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...
.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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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....
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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,...
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...
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...
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 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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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....
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...
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...
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...
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...
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...
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”...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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,...
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...
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...
“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...
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...
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...
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...
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...
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...
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...
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...
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...
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....
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...
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...
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...
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...
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...
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.”...
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,...
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...
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...
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 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...
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,...
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...
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....
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...
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:...
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...
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,...
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...
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....
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...
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,...
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 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...
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...
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...
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...
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”...
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...
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...
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...
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...
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...
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...
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...
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 ...
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....
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...
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...
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...
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...
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,...
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...
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...
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” 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...
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....
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...
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...
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...
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...
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...
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...
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....
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...
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 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...
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...
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...
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...
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...
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...
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...
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...
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....
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...
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...
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...
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...
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....
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...
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...
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...
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...
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 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...
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...
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...
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...
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...
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,...
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...
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 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...
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...
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...
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...
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...
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...
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 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...
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 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’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...
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...
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...
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...
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 ...