Skip to main content

Carson Gross on Dirty Code vs. Clean Code and Testing Strategies

ChangelogJuly 9, 202519 min2,132 views
24 connections·33 entities in this video→

Challenging "Clean Code" Ideology

  • πŸ’‘ Carson Gross argues against the rigid adherence to "Clean Code" principles, particularly those popularized by Bob Martin.
  • 🎯 He aims to reassure younger developers that alternative, successful coding styles exist and they shouldn't be intimidated by dominant ideologies.
  • πŸ”‘ Gross's approach, which he terms "quick and dirty," contrasts with conventional "clean code" recommendations.

Key Areas of Disagreement

  • 🚫 Short Methods: Gross believes long methods are acceptable, especially if they represent important logic and refactoring doesn't offer clear code reuse.
  • 🚫 TDD/Unit Testing: He prefers integration or end-to-end tests over strict Test-Driven Development and unit testing of individual functions.
  • 🚫 Class Density: He advocates for denser, larger classes that might mix concerns, contrary to the single responsibility principle often emphasized in clean code.

The Case for Longer Methods

  • πŸ“ Gross doesn't have a strict line count but feels antsy beyond 100 lines. He prioritizes code reuse as the primary driver for extraction.
  • 🧠 He believes important functions should be large and unimportant ones small, making it easier to grasp core logic without excessive navigation.
  • ⚠️ Extracting functions incurs costs like naming commitments and potential constraints on future changes, which he feels are often underestimated.
  • πŸ“Š Empirical studies suggest that functions up to around 200 lines of code may have fewer bugs per line, challenging the aesthetic-based assertion that longer methods are inherently bad.

Testing Philosophy: Integration Over Unit

  • πŸ” Gross prefers integration tests or end-to-end tests because they focus on higher-level truths and tend to be more resilient to refactoring.
  • 🐌 He finds unit tests often test implementation details, leading to brittle tests that break easily during refactors, creating a burden in large codebases.
  • πŸš€ While acknowledging the speed and ease of writing unit tests, he believes their focus on low-level details can hinder progress.
  • ⚠️ End-to-end tests, while valuable, can be fragile due to their distance from the code, requiring a careful balance to remain useful.

Development Trade-offs

  • βš–οΈ Gross emphasizes that all development tools and approaches have trade-offs, and wisdom lies in finding the "golden mean" rather than blindly following one methodology.
  • πŸ’‘ He cautions against presenting any single approach as unilaterally the best, encouraging discussion of associated costs and benefits.
Knowledge graph33 entities Β· 24 connections

How they connect

An interactive map of every person, idea, and reference from this conversation. Hover to trace connections, click to explore.

Hover Β· drag to explore
33 entities
Chapters9 moments

Key Moments

Transcript71 segments

Full Transcript

Topics14 themes

What’s Discussed

Clean CodeDirty CodeBob MartinCarson GrosshtmxSoftware DevelopmentCoding StyleMethod LengthUnit TestingIntegration TestingTest-Driven Development (TDD)RefactoringCode ReuseSoftware Design Principles
Smart Objects33 Β· 24 links
PeopleΒ· 4
ConceptsΒ· 27
MediaΒ· 1
ProductΒ· 1