Don't Fear the New Type: Lessons from Go and C

2025-03-22

Many developers exhibit a reluctance to create new types in their codebases. This article argues that this stems from a fear of altering the perceived 'grand design' and adding complexity. However, the author contends that when a set of values naturally belongs together, creating a new type significantly improves code readability and maintainability. Using Go as an example, the author highlights the benefits of creating small, purpose-built types like a `CreateSubscriptionRequest` struct, streamlining data handling across function calls. The author encourages developers to overcome their apprehension about creating new types, emphasizing that in C and Go cultures, this practice is common and accepted, provided the type's purpose is clearly conveyed through its name.

Development