Code architecture vs system architecture
“What is the difference between code architecture and system architecture? Can one be good while the other is bad? Give an example of each direction.”
What this tests
- Whether the candidate can hold the four levels apart (code, application, system, infrastructure)
- Understanding that they are decided and changed at different cadences
- Ability to give a concrete example instead of a definition
Answers by level
Read the beginner answer first and notice what is missing.
Code architecture is about dependencies inside a process: which module may import which, where business rules live, whether the domain depends on the database driver. It is changed by refactoring and enforced by the compiler and linting. System architecture is about dependencies across processes: which service owns which data, what talks over the network, where queues sit, what fails independently. It is changed by migrations and enforced by nothing except discipline and contracts.
They are independent. A monolith with clean hexagonal internals has good code architecture and a perfectly reasonable system architecture. Nine microservices that all read the same database and deploy together have a fashionable system architecture and none of its benefits. Good code inside a bad system: a well-tested order service that makes eleven synchronous calls per request. Bad code inside a good system: a service with the right boundary and one 4,000-line file.
The cost profiles differ. A code-level mistake costs a refactor. A system-level mistake — the wrong data owner, a synchronous chain where an event was needed — costs a migration with dual writes and a cutover.
Green flags · Red flags
- Defines the levels by what they govern (in-process vs cross-process dependencies)
- Gives an example in each direction, not just a definition
- Notes that system mistakes cost migrations while code mistakes cost refactors
- Mentions that boundaries can exist in code before they exist on the network
- "System architecture is just code architecture at a bigger scale."
- Cannot give an example of good code inside a bad system
- Believes microservices are how you get good code boundaries
- Conflates infrastructure choices (Kubernetes, cloud vendor) with architecture