ArjanCodes

Too Many Parameters? Use This Pattern

Jun 26, 2026 14 min
pythonsoftware designrefactoringdataclasses
Watch on YouTube Follow ArjanCodes on Rundown — free

Summary

AI summaries can be incomplete or wrong. Verify anything important against the original video.

This tutorial shows how to address function parameter proliferation by implementing the Parameter Object pattern in Python.

The video demonstrates how functions that accumulate too many parameters become difficult to read, maintain, and extend. The instructor introduces the Parameter Object pattern as a refactoring solution, showing how to group related data into a dedicated class. The process involves creating a dataclass for search criteria, moving validation logic into the object using '__post_init__', and using properties to encapsulate derived data like cache keys. The tutorial emphasizes that this approach simplifies function signatures and improves code readability. It also includes a bonus lesson on combining parameter objects with structural pattern matching in Python to handle conditional logic more cleanly than using traditional 'if-else' statements, while warning against common pitfalls like stamp coupling.

Steps to follow

Locked
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

Key Points

Locked

Worth watching if: You are a Python developer struggling with functions that have overly long argument lists and want a cleaner, more object-oriented approach to manage them.

Sign in to unlock the full extract

Every claim, key point, and timestamp for this ArjanCodes video — plus a daily email of every channel you follow.

Sign in with Google

No credit card. Free tier forever.

Watch on YouTube