ruk·si

Codebase

Updated at 2017-06-22 17:14

This note has all the common terminology related to different parts of source code.

Codebase is a collection of source code that is stored in one repository and deployed independently.

It doesn't mean a single codebase has to operate independently. Especially common in microservices architectural pattern.

How to introduce yourself to a new codebase:

  1. How does the overall infrastructure look?
  2. How is the code deployed?
  3. Step debug through the whole program for a couple of executions.
  4. Write a couple of black box end-to-end tests if there aren't any.

Other units of code:

  • Expression: a collection of characters that are computed to produce a value. For example, 2+3 and b (variable) are expressions.
  • Line: a collection of characters that ends with a new line.
  • Statement: the smallest standalone element of a programming language that describes an action. One statement can be split on multiple lines. Many programming languages end statements with ;.
  • Unit: the smallest grouping of statements that can be executed independently like a method or a function. This is where the term "unit test" comes from, testing the smallest possible executable part of a system.
  • Module: the smallest grouping of units like a class in object-oriented programming.
  • Component: division of a system defined by its architecture, not always defined by a programming language itself but for example Go has packages, Python has modules and Java has namespaces that can be used to define components.
  • System: the entire codebase under study, not defined.

Sources

  • Building Maintainable Sofware, O'Reilly