Code purpose

Code purpose is about what code does in a software system — its function, its role, the job it performs. This is different from code structure, which is about how code is organized.

When building software, thinking in terms of purpose helps you identify the right architectural patterns. Whether you need to handle business logic, store and retrieve data, manage user interaction, enforce security, or ensure the system can evolve over time, understanding the purpose of different code leads to better architecture decisions.

The categories below group architectural patterns by their purpose. In a simple project, different types of code might all live in the same files and functions. As projects grow, separating these concerns into distinct layers, modules, or services becomes crucial for maintainability, testability, and scalability.