Sponsor
Your Product
List your product
C# design principles · interactive

Make code SOLID.

Five design principles, one hands-on tour. Spot the code smell, flip to a refactor, then test your instincts in the quiz.

Start exploring

The acronym

Not rigid laws or a checklist for every class. Use them to reduce coupling and make change safer.

Five principles, your turn

Spot it. Then improve it.

Choose a letter, judge the example, and flip between the design smell and one possible refactor.

S

Single Responsibility

One reason to change

Keep each class focused on one responsibility, so a change in one concern does not ripple into unrelated behavior.

This class mixes report creation with file persistence. Those concerns can change for different reasons.

C# example

Needs a rethink

public class Report
{
    public string Generate() => "report";
    public void Save(string report) { /* write file */ }
}

right or wrong: does this example have a design smell?

Interview warm-up

Can you spot the principle?

Question 1 of 5

A class formats invoices and sends email notifications. What is the likely issue?

Adapted from our SOLID principles in C# interview guide. These are design heuristics, not rules to apply mechanically.