Software Architecture Interview Questions
Software Architecture Interview Questions – Comprehensive Study Notes
Explaining Your Project Architecture (50,000 ft → 10,000 ft)
When asked to explain the architecture of a project, a senior candidate should not give a one‑line answer (e.g., “MVC”). Instead, glide from a high‑level view down to detailed patterns.
50,000 ft level: Describe the major layers or components of the system – UI layer (e.g., Angular, React), middle layer (e.g., ASP.NET MVC), database (SQL Server), cloud hosting, common libraries.
30,000 ft level: Inside each layer, explain the architecture pattern used (e.g., MVC within the ASP.NET layer). The Model contains business logic, the View handles look‑and‑feel, the Controller binds them.
10,000 ft level: Discuss specific design patterns applied at code level – Repository pattern for data access, Unit of Work for transactions, Factory pattern for object creation, Singleton for caching, Dependency Injection, etc.
Also mention security (e.g., OpenID Connect, OAuth 2.0 with Azure AD).
Key takeaway: A detailed, polished answer that shows breadth and depth is expected from a senior architect. You need to adapt this structure to your own project, not just repeat the example.
Architecture Style vs Architecture Pattern vs Design Pattern
Architecture Style
Highest level (50,000 ft). Defines guidelines and principles for how a system should be structured at a macro level.
Examples: REST (defines statelessness, resource‑based thinking, uniform interfaces like GET/POST/PUT/DELETE), SOA, Event‑Driven.
No block diagrams or fixed structure – just principles.
Architecture Pattern
Intermediate level (30,000 ft). Provides a structural block diagram – defines the major components and their relationships but does not specify code‑level implementation.
Examples: MVC (Model‑View‑Controller), MVP (Model‑View‑Presenter), MVVM (Model‑View‑ViewModel), Layered Architecture, Three‑Tier.
In MVC, you know there will be a Controller, a View, and a Model – but not how the controller is implemented in a specific language.
Design Pattern
Lowest level (10,000 ft). Context‑specific, time‑tested solution for a recurring architecture problem at the code level. The code implementation is often very similar across languages.
Examples: Singleton (private constructor + static instance), Factory, Iterator, Adapter, Repository, Unit of Work, CQRS.
Each design pattern has a clear problem context and a proven solution, down to the method signatures.
Important: Do not guess the category of a term like Dependency Injection, Dependency Inversion, or IoC during an interview – it can break trust. If unsure, say “I need to look into it.”
Design Patterns – Foundational Questions
What are Design Patterns?
Time‑tested, reusable solutions for recurring architecture problems in software development.
They are not a silver bullet for all software problems – only for architecture issues.
How to answer as a senior:
Qualify with examples: e.g., Adapter pattern solves incompatible interfaces; Iterator pattern allows sequential access without exposing internal structure; Template pattern defines a skeleton algorithm and lets subclasses override specific steps; Repository pattern abstracts and centralizes data access logic.
Important tips:
Avoid using **Singleton** as your primary example (it’s overused).
Don’t stick only to Gang of Four (GoF) patterns – mention **non‑GoF** patterns like Repository, Unit of Work, CQRS.
Only talk about patterns you are **confident** with – ideally ones you have actually used in your own projects.
Three Categories of Design Patterns (GoF)
Creational: Deal with object creation issues. Examples: Singleton (single instance), Factory (centralize creation), Prototype (clone an object).
Behavioral: Focus on communication between objects. Examples: Mediator (reduce chatty communication), Memento (capture internal state), Chain of Responsibility (pass request along a chain).
Structural: Concern object composition and structure. Examples: Adapter (incompatible interfaces), Composite (treat individual and composite objects uniformly), Decorator (add responsibilities dynamically).
Note: In modern architecture (microservices, DDD), many new patterns (Repository, CQRS, Aggregate Root) do not fit neatly into these three categories, but knowing the GoF categories is still expected in interviews.
“Which design patterns have you used in your project?”
Four suggestions:
Do not answer “Singleton” – stand out.
Mention both GoF and non‑GoF patterns.
Only talk about patterns you are truly confident with.
Review your own project to find patterns you used unknowingly (e.g., foreach loop = Iterator pattern; exposing a Web API = Facade pattern; menu with submenus = Composite pattern).
10 patterns commonly found in projects:
Repository – abstraction over data access, centralizes common code.
Unit of Work – manages transactions across repositories (all or nothing).
Iterator – iterate over aggregates without exposing underlying representation. In .NET/Java,
IEnumerable/IEnumeratoris the built‑in implementation.Factory – centralize object creation, let subclasses decide the concrete type.
Adapter – make two incompatible interfaces work together, especially with third‑party components.
Decorator – add/remove behaviour dynamically to an object.
Command – treat a request as an object (e.g.,
ICommandin MVVM; basis for CQRS).Facade – provide a simplified interface to a complex subsystem (e.g., a single Web API that hides complex accounting logic).
Composite – compose objects into tree structures (e.g., menu‑submenu; shapes containing shapes).
Template Method – define the skeleton of an algorithm; subclasses override specific steps (e.g., ETL pipeline with fixed steps).
Deep Dive: Singleton Pattern
What is Singleton?
A creational design pattern that ensures a class has only one instance and provides a global point of access to that instance.
Common use cases:
Caching – shared collection of country masters, state masters, currency data; avoids repeated database trips.
Common data sharing – application‑wide configuration, themes, session data.
Six Essential Steps to Implement Singleton (Thread‑Safe, Lazy, Performant)
Dedicated wrapper class – encapsulate the singleton objects in a separate class (e.g.,
Singletonclass).Private constructor – prevents external instantiation.
Static instance – the single instance is stored in a
private staticfield.Thread‑safety with
lock– ensures only one thread can create the instance at a time.Lazy loading – create the instance only when first requested (double‑null check).
Double‑null check – first null check outside the lock for performance (avoid locking every call), second null check inside the lock for thread safety.
Code example (C#):
public class Singleton
{
private static Singleton _instance = null;
private static readonly object _lock = new object();
private Singleton() { }
public static Singleton Instance
{
get
{
if (_instance == null) // first null check (performance)
{
lock (_lock)
{
if (_instance == null) // second null check (thread safety)
{
_instance = new Singleton();
}
}
}
return _instance;
}
}
}Static vs Singleton
Static is a keyword (programming concept). Singleton is a design pattern with a specific code structure.
Singleton uses static internally but adds thread safety, lazy loading, performance optimizations, and object‑oriented features.
Making a class
staticloses OOP capabilities: cannot implement interfaces, cannot inherit, cannot participate in polymorphism.Singleton retains full OOP support while ensuring a single instance.
Thread Safety in Singleton
In a multi‑threaded environment, two threads may simultaneously check for null and create two instances, leading to race conditions and partial initialization (one thread reads incomplete data).
Using
lockensures only one thread enters the critical section. Other threads block until the instance is fully created.
Double Null Check Explained
First null check (outside lock) – for performance: if the instance already exists, we skip the expensive
lockentirely.Second null check (inside lock) – for thread safety: after the lock is acquired, another thread might have already created the instance while the first thread was waiting, so we check again.
This pattern is often called double‑checked locking.
Using C# Lazy<T> (Modern Approach)
The .NET Framework provides the Lazy<T> class that handles lazy initialization, thread safety, and double‑null check automatically.
public class Singleton
{
private static readonly Lazy<Singleton> _instance =
new Lazy<Singleton>(() => new Singleton());
private Singleton() { }
public static Singleton Instance => _instance.Value;
}When accessing Instance, the Lazy<T> ensures the creation function runs only once and is thread‑safe. This simplifies the code significantly.
GUI Architecture Patterns: MVC, MVP, MVVM
What is a GUI Architecture Pattern?
A way to structurally organize the interaction code between the View (UI) and the Component (Model / business logic). The goal is Separation of Concerns (SoC) – each part handles a distinct aspect.
Common patterns: MVC, MVP, MVVM. All implement SoC but differ in how the view is updated and where the interaction code resides.
Model-View-Controller (MVC)
Structure: Controller, Model, View.
Responsibilities:
Controller: First point of entry. Takes user input (HTTP request, button click), loads the appropriate Model, and selects the View.
Model: Contains business logic and data.
View: Handles presentation – layout, look‑and‑feel, positioning.
Flow: User request → Controller → loads Model → passes Model to View → View renders the UI.
Example: ASP.NET MVC, Spring MVC.
Key characteristics: Controller is active; View is dumb (only renders); Model is independent.
Model-View-Presenter (MVP)
Structure: Presenter, View, Model.
Responsibilities:
View: Passive – only contains UI controls. Delegates all user actions to the Presenter.
Presenter: Acts as a mediator. Takes input from View, calls Model, and updates View via callbacks (through an interface).
Model: Business logic.
Flow: User clicks → View → calls Presenter (with a reference to itself) → Presenter updates Model → Presenter calls back to View to update display.
Example: WinForms, ASP.NET WebForms (legacy), GWT.
Why is the View called “passive”? Because it does nothing on its own – it submits itself to the Presenter, which controls all decisions. The Presenter holds a reference to the interface of the View, not the concrete View, enabling testability.
Importance of the Interface (
IView): The Presenter communicates with the View only through an interface (e.g.,ICounterView). This decouples the Presenter from the concrete UI and makes unit testing easy.
Model-View-ViewModel (MVVM)
Structure: View, ViewModel, Model.
Responsibilities:
View: Similar to MVP – passive but relies on automated bindings (declarative) to connect to the ViewModel.
ViewModel: Encapsulates the Model and exposes everything the View needs: data (e.g., counter value), commands (e.g.,
IncrementCommand), and aesthetics (e.g., background colour, enabled/disabled state). It is not a copy of the Model; it shapes data for the View.Model: Business logic.
Flow: User interacts with View → bindings automatically call ViewModel methods → ViewModel updates Model → bindings push changes back to View.
Example: WPF, Angular, Knockout, React (with state management).
Key difference from MVP: Automated / declarative bindings eliminate the need for explicit callback code. The ViewModel communicates with the View via data binding, not through an interface.
Difference Between MVC, MVP, MVVM (At a Glance)
Aspect | MVC | MVP | MVVM |
|---|---|---|---|
First hit | Controller | View | View |
Binding | No automated bindings | No automated bindings | Automated bindings (declarative) |
View nature | Active (renders after model passed) | Passive – submits to Presenter | Passive – relies on bindings |
Testability | Moderate (controller can be tested) | High (presenter tested via mock view) | High (ViewModel tested independently) |
Typical technology | ASP.NET MVC, Spring | WinForms, WebForms | WPF, Angular |
How to Choose Between MVC, MVP, MVVM?
Technology‑driven: The choice is usually dictated by the framework/technology you are using.
Use MVC if the technology loads the view through a controller first (e.g., ASP.NET MVC, Spring, Laravel).
Use MVP if the technology loads the view first and does not support automated binding (e.g., WinForms, ASP.NET WebForms, Java applets).
Use MVVM if the technology loads the view first and supports automated binding (e.g., WPF, Angular, Knockout, React with two‑way binding).
Some modern frameworks (e.g., Angular) combine both – they have a component (like a controller) plus declarative bindings – so they can be considered MVVM or a hybrid.
What is a ViewModel Class (In General)?
A ViewModel is a class that encapsulates the Model and provides everything the View needs to function: data, commands, validation, aesthetics (colours, visibility, enable/disable).
It is not just a data‑transfer object – it includes behaviour for UI interactions.
In MVVM, the ViewModel additionally uses bindings and commands (e.g.,
ICommand) to automate communication.
Layered Architecture vs Tiered Architecture (Layer vs Tier)
Separation of Concerns – The Core Principle
Both layers and tiers are about dividing the application into distinct parts, each with a specific responsibility.
Three‑Layer Architecture (Logical)
The application is organized into logical layers (e.g., Presentation, Business Logic, Data Access).
All three layers can run on the same physical machine.
Communication within the same process (method calls).
Example: A single server application with UI classes (WinForms), business logic classes, and data access classes compiled together.
Three‑Tier Architecture (Physical / Deployment)
The logical layers are deployed on separate physical machines (different servers).
Communication between tiers occurs over a network (HTTP, TCP/IP, queues).
Complexity increases because you must handle network latency, serialization, security, and potential failures.
Example: Web server (presentation), application server (business logic), database server.
Aspect | Layer | Tier |
|---|---|---|
Scope | Logical / conceptual structure | Physical / deployment structure |
Location | Can be on the same machine | Separate machines |
Communication | In‑memory / direct calls | Network (HTTP, TCP, queues) |
Complexity | Lower | Higher (network issues, security, latency) |
Important: Saying “three‑tier” implies physical separation and the extra communication overhead. “Three‑layer” means logical separation, often deployed together. Use the terms precisely in interviews.
Non‑Technical Interview Tips (Key Points)
Candidate‑driven questions: You can steer the interview toward topics you know well by mentioning patterns or technologies you are strong in. For example, if you mention you used Singleton, Repository, and CQRS, the interviewer may follow up on those.
Never guess: If you don’t know the answer, diplomaticaly say “I need to look into that” instead of giving a wrong answer. Loss of trust at a senior level can ruin the entire interview.
Be natural: When you talk about patterns you actually used, your confidence and natural tone will impress the interviewer more than a rehearsed answer.
Your answer must be your own: Customise the explanation to match your real project experience.
These notes cover the core subjects of the video: project architecture explanation, architecture styles/patterns/design patterns, Singleton pattern in detail, MVC/MVP/MVVM, and layered vs tiered architecture. The next logical topics (SOLID principles, design pattern deep dives, DDD, Microservices) build on this foundation.

Ask anything
We've read this whole study set, so questions about it get the best answers.