Skip to main content
AmigoFish

ArjanCodes

ArjanCodesVideoLast show:

Not rated yet

About this show

On this channel, I post videos about programming and software design to help you take your coding skills to the next level. I'm an entrepreneur and a university lecturer in computer science, with more than 20 years of experience in software development and design. If you're a software developer and you want to improve your development skills, and learn more about programming in general, make sure to subscribe for helpful videos.

I post a video here every Friday. If you have any suggestion for a topic you'd like me to cover, just leave a comment on any of my videos and I'll take it under consideration.

Thanks for watching!

Videos come from the channel's public YouTube feed. The artwork is the newest video thumbnail. Last updated . Names, artwork and text belong to their publishers.

Cosmos

Similar by topic and creator

See the full Cosmos

Videos

  • I Made a Classic Refactoring Mistake

    · 16 min

    💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. In my previous video on refactoring complicated business logic, I made several mistakes and you spotted them. In this video, I go through what went wrong, why these kinds of errors are so easy to introduce during refactoring, and the traps developers fall into when they assume they understand the rules encoded in existing code. We’ll look at how tests, coverage, and “cleaner” code can still hide logical mistakes, and why there often is no single ground truth when dealing with business logic. Original video where I covered the refactoring: https://youtu.be/mH7e7fs9gaE 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 0:27 Context 1:35 Three mistakes 4:27 A few other issues and remarks 9:13 Traps / what is the ground truth? 14:40 Final thoughts #arjancodes #softwaredesign #python

    Not rated yet
  • How to Tell If Your Code Is Actually Production-Ready

    · 24 min

    💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. Your code works locally: you’ve tested the endpoint, the numbers add up, and everything looks fine in the terminal. But is it really ready for production? In this video, I take a small FastAPI app that “just works” and walk you through the key steps to make it production-ready. You’ll learn how to add validation, logging, rate limiting, configuration management, proper database handling, error handling, deployment with Docker, and more. 🔥 GitHub Repository: https://git.arjan.codes/2025/production. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 0:46 What Does Production-Ready Actually Mean? 2:14 Step 1 – Use Proper Types (Decimal over float) 3:41 Step 2 – Validate Input 5:00 Step 3 – Extract Business Logic into a Service 9:56 Step 4 – Add Persistence (and Use It in the Service) 15:27 Step 5 – Add Health Check + Migrations 16:19 Step 6 – Defensive Programming + Error Handling 18:10 Step 7 – Configuration Management 19:17 Step 8 – Rate Limiting 20:50 Step 9 – Write Tests 22:24 Step 10 – Monitoring & Logging 23:12 Step 11 – Deployment (Docker + GitHub Actions) 23:58 Final Thoughts #arjancodes #softwaredesign #python

    Not rated yet
  • Retry Pattern: The Secret to Resilient Python Code

    · 24 min

    👉 Get real-time, search result data from Google, Youtube and more with SerpApi: https://serpapi.link/arjan-codes. This video shows you how to stop your Python code from crashing when APIs, networks, or LLMs fail at random. I walk through the Retry Pattern step-by-step: starting with a flaky example, adding simple retries, improving them with exponential backoff, turning the logic into a clean decorator, and finally adding fallback routes when retrying the same thing no longer makes sense. You’ll also see how retries help when working with LLMs that sometimes return invalid JSON. By the end, you’ll know exactly when to retry, when not to, and how to make your applications far more resilient. Design pattern playlist: https://www.youtube.com/playlist?list=PLC0nd42SBTaNf0bVJVd9e2oBV-mcUuxS0 🔥 GitHub Repository:https://git.arjan.codes/2025/retry. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 0:53 The Problem: Transient Failures 1:35 A Simple Retry Function 7:14 Exponential Backoff 9:32 Using a Decorator (with @wraps) 12:53 LLM Example (JSON with the New API) 14:48 When You Shouldn’t Retry the Same Thing 21:06 Production-Ready Option with Tenacity 21:47 When (Not) to Use the Retry Pattern 23:15 Final Thoughts #arjancodes #softwaredesign #python

    Not rated yet
  • From Spaghetti Code to Clean Python

    · 23 min

    💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. Untangling deeply nested if/else logic is one of the hardest parts of working in real-world Python codebases. In this video, I take a brutally messy example full of indentation, duplicated conditions, and hidden business rules, and systematically break it down into clean, readable logic. You’ll see how to write characterization tests to protect the existing behavior, how to flatten the structure using guard clauses, how to simplify and combine conditions, and how to deal with special cases like admin overrides without breaking anything. By the end, you’ll understand exactly how to transform complicated boolean logic into code that’s easy to read, easy to test, and easy to extend. 🔥 GitHub Repository: https://git.arjan.codes/2025/logic. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 0:48 Why Code Like This Happens 2:57 Write Characterization Tests (Your Safety Net) 6:04 Flatten the Nesting with Guard Clauses 11:26 Remove Unnecessary Try/Except Blocks 13:10 Simplify and Name Conditions 15:26 Simplify Loops and Comprehensions 16:28 Merge Duplicate Logic 19:07 Move Rules to Data 22:01 Final Thoughts #arjancodes #softwaredesign #python

    Not rated yet
  • The Lazy Loading Pattern: How to Make Python Programs Feel Instant

    · 19 min

    💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. In this video, I dive deep into the **Lazy Loading pattern,** one of the simplest and most effective ways to make Python applications feel instantly responsive. I start with a painfully slow CSV-loading example and progressively improve it using **lazy evaluation**, **generators**, **caching**, **time-limited caching**, and even **background preloading**. Along the way, you’ll learn when (and when not) to use lazy loading, how it’s used in real-world libraries, and how to apply it cleanly in your own projects. By the end, you’ll understand how to avoid unnecessary work, reduce memory usage, and make your Python code dramatically faster without overcomplicating your design. Design pattern playlist: https://www.youtube.com/playlist?list=PLC0nd42SBTaNf0bVJVd9e2oBV-mcUuxS0 🔥 GitHub Repository: https://git.arjan.codes/2025/lazy. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 0:48 A Bit of History (and Where You Already See It) 1:53 The Naive (Eager) Approach 2:29 Lazy Loading 3:38 Simple Caching with functools.cache 5:15 Adding a Remote Operation 9:24 Now With Custom Caching 11:13 Lazy Streaming with Generators 15:20 Smarter Preloading 17:21 When (and When Not) to Use Lazy Loading 18:08 Common Mistakes with Lazy Loading 18:52 Final Thoughts #arjancodes #softwaredesign #python

    Not rated yet
  • Stop Hardcoding Everything: Use Dependency Injection

    · 32 min

    → Check out Thesys here: https://www.thesys.dev/?utm_source=youtube&utm_medium=creators&utm_campaign=arjan In this video, I explore how Dependency Injection can make your Python code cleaner, more testable, and easier to extend, using a real-world data pipeline example. I start with a tightly coupled version and progressively refactor it using manual injection, a lightweight custom DI container, and even show how frameworks like FastAPI handle DI under the hood. Design pattern playlist: https://www.youtube.com/playlist?list=PLC0nd42SBTaNf0bVJVd9e2oBV-mcUuxS0 🔥 GitHub Repository: https://git.arjan.codes/2025/di. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 0:57 The Problem: No DI 1:29 What Is Dependency Injection? 2:13 Refactoring with Manual DI 17:19 Going Further: A Simple DI Container 28:04 Dependency Injection in FastAPI 29:53 Use Cases for Dependency Injection 30:52 Final Thoughts #arjancodes #softwaredesign #python

    Not rated yet
  • Stop Overwriting State And Use Event Sourcing Instead

    · 25 min

    → Try Flox for free: https://flox.dev/?utm_source=youtube&utm_medium=social&utm_campaign=Arjan&utm_content=homepage In this video, I explore how to build an inventory system using the event sourcing pattern in Python, step by step. You’ll learn what event sourcing is, why it’s useful, and how it lets you track every change over time instead of just storing the final state. We’ll start with a basic implementation using string events, add caching for performance, then evolve the system with structured Item objects and projections to analyze the data. Plus, we’ll look at real-world parallels like Git and blockchain, and discuss when (and when not) to use this pattern in your own projects. Design pattern playlist: https://www.youtube.com/playlist?list=PLC0nd42SBTaNf0bVJVd9e2oBV-mcUuxS0 💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. 🔥 GitHub Repository: https://git.arjan.codes/2025/event. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 0:30 What Is Event Sourcing? 1:32 Step 1: The Basic Example (String-Based Inventory) 12:57 Step 2: Add Caching to Avoid Replaying on Every Read 17:55 Step 3: Make It More Realistic with a Full Item Object 21:08 Step 4: Add Projections for Analytics 22:44 Pros of Event Sourcing 23:19 Cons of Event Sourcing 23:50 When Should You Use It? 24:26 Final Thoughts #arjancodes #softwaredesign #python

    Not rated yet
  • Learning Python Feels Easy. Until It Isn’t.

    · 25 min

    → Python Programming Fundamentals course (DataCamp): https://datacamp.pxf.io/POPxVR → Associate Python Developer track (DataCamp): https://datacamp.pxf.io/Dy2oea Python is often praised as the easiest programming language to learn, but that simplicity can be deceptive. In this video, I break down the real Python learning curve and show you how to go from basic syntax to writing clean, testable, professional-grade software. We’ll cover the steps I’d take if I had to learn Python all over again: mastering the core, writing Pythonic code, understanding types and protocols, designing better abstractions, and more. 🔥 GitHub Repository: https://git.arjan.codes/2025/learn. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 1:30 Step 1: Master the Core Through Small Transformations 5:27 Step 2: Write Pythonic Code on Purpose 6:55 Step 3: Build Tools, Not Just Apps 8:49 Step 4: Learn How Python Thinks 12:58 Step 5: Use Abstractions and Types to Understand Your Data 18:33 Step 6: Design Your Code Like a Software Engineer 20:06 Step 7: Write Tests Like a Pro 23:49 Step 8: Dive Into Internals (When Ready) 24:34 Final Thoughts #arjancodes #softwaredesign #python

    Not rated yet
  • How to Write Python That Feels Like Python

    · 26 min

    💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. What does it actually mean to write *Pythonic* code? In this video, we answer that question by taking a small, messy script and refactoring it step by step using the core principles of idiomatic Python. Along the way, you’ll learn how to think like a Pythonista: using functions instead of unnecessary classes, leveraging dataclasses, writing readable control flow, embracing tools like pathlib and logging, and applying the Zen of Python in practice. 🛍️ Check out ArjanCodes merch: https://shop.arjancodes.com. 🔥 GitHub Repository: https://git.arjan.codes/2025/pythonic. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 0:18 What does Pythonic mean? 2:08 Before 3:13 Step 1 – Prefer Functions Over Classes 4:32 Step 2 – Use Context Managers 6:42 Step 3 – Add Type Annotations 10:46 Step 4 – Favor EAFP Over LBYL 12:06 Step 5 – Use Dataclasses for Structured Data 17:09 Step 6 – Centralize File Paths and Use 19:19 Step 7: Rely on Python's strengths 23:10 Step 8 – Add Logging Instead of Print 24:10 Step 9 – Add a Main Function 25:56 Final Thoughts #arjancodes #softwaredesign #python

    Not rated yet
  • Too Many Function Arguments? Use This Pattern

    · 19 min

    💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. Tired of passing five arguments to every function? In this video, I clean up a realistic Python codebase using the Context Object Pattern. You’ll see how to go from messy, repetitive function signatures to a cleaner and more maintainable design. We’ll introduce context objects, explore how they help reduce parameter bloat, discuss the trade-offs (like increased coupling), and show how to use Protocols to keep things decoupled and testable. 🔥 GitHub Repository: https://git.arjan.codes/2025/context. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses. 💬 Join my Discord server: https://discord.arjan.codes. ⌨️ Keyboard I’m using: https://amzn.to/49YM97v. 🔖 Chapters: 0:00 Intro 1:07 The Before Version: Too Many Arguments 3:43 Introducing the Context Object Pattern 9:35 But Wait — Aren't We Adding a Bunch of Coupling? 10:56 Making a Distinction Between High-Level vs Low-Level Code 13:33 High-Level Convenience, Low-Level Clarity 15:07 Using Abstraction 17:22 When Should You Use Context Objects? 18:51 Final Thoughts #arjancodes #softwaredesign #python

    Not rated yet