How do you get better at writing and structuring a large codebase?

Arpit Bhayani

Arpit Bhayani

Feb 12, 2024 • 2 min read


How do you get better at writing and structuring a large codebase? ⚡

More than reading popular books on Design Patterns, two things that helped me write and structure a large codebase better were

  1. reading a lot of good open source codebase (with similar stack)
  2. coding and collaborating a lot on the same codebase

I understand the importance of reading general-purpose design patterns, but they might not suit your programming language or stack well. For example, interface-driven patterns that are Java do not fit the Go codebases well.

Pick books covering design patterns written for your language because they will delve into the nuances and practical applications of patterns within the context of your language instead of some arbitrary advice.

Hence, I recommend reading multiple good codebases written in a similar tech stack giving you an idea of different approaches and architectural styles people are using to structure and and write extensible code.

While reading the codebase, instead of blindly copying and pasting the code snippets; understand the rationale behind those decisions, trade-offs made, and how it helped in making the code extensible and better.

When you adopt those patterns in your codebase, challenge your assumption, compare your approach with theirs, and question your own decisions. This looks tedious, but an essential step to ensure you form the right intuition over time; making it easier the next time you write.

⚡ I keep writing and sharing practical nuggets, so if you are keen on learning them, follow along.

youtube.com/c/ArpitBhayani

no fluff engineering.

Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses