Cheat sheet · Foundations
Software design and clean code cheat sheet (C#)
Opens with creditsFor students and early-career engineers who can write working C# and now want it to stay easy to change: OOP used properly, SOLID, clean code, all 23 classic design patterns, UML, refactoring and small designs end to end. Every sketch is modern C# with records, interfaces and dependency injection.
Chapters
10 chapters · 73 concepts
1Object-oriented programming properlyClasses, objects and the four ideas behind them, used to protect rules and hide change rather than to build deep family trees. Composition over inheritance starts here.8 concepts
- 1Class and objectA class is a blueprint that bundles data (fields) with the behaviour that works on it (methods).
- 2EncapsulationHiding an object's internal state behind a small public interface, so outside code can only change it through methods that keep its rules (invariants) true.
- 3AbstractionShowing callers what something does and hiding how it does it.
- 4InheritanceA subclass takes on the fields and methods of a parent class and can add to or override them.
- 5PolymorphismOne call working on many types: code asks any Shape for its area, and each type answers in its own way.
- 6Interfaces and abstract classesAn interface lists methods a type promises to provide, with no state.
- 7Composition over inheritanceBuilding a class by holding other objects and delegating to them (has-a) rather than by extending a parent (is-a).
- 8Value objects and immutabilityA value object is defined by its values, not an identity: two Money(10, "USD") objects are equal.
8 in this chapterOpen this chapter2SOLID principlesFive principles for classes that are easy to extend and test, each with the smell it prevents. Learn them as questions to ask of a design, not as rules to recite.7 concepts
- 1Single responsibility principle (SRP)A class should have one reason to change, meaning it answers to one group of people or one kind of decision.
- 2Open/closed principle (OCP)Code should be open for extension and closed for modification: you add behaviour by adding new code, such as a new class, rather than editing working code.
- 3Liskov substitution principle (LSP)A subtype must work anywhere its parent type is expected without surprising the caller: it may not demand more, promise less or throw where the parent would…
- 4Interface segregation principle (ISP)Clients should not be forced to depend on methods they do not use.
- 5Dependency inversion principle (DIP)High-level policy should not depend on low-level details; both should depend on an abstraction.
- 6Dependency injectionPassing an object the things it needs, usually through its constructor, instead of letting it create or look them up itself.
- 7DRY, KISS and YAGNIDRY: every piece of knowledge has one home.
7 in this chapterOpen this chapter- Clean code: names, functions and errorsThe small decisions made hundreds of times a day: what to call things, how big a function should be, when to comment, and how to fail loudly and clearly.7 conceptsOpens with credits
- Creational patternsThe five Gang of Four patterns about how objects get made: one shared instance, a subclass choosing the type, families of related objects, step-by-step construction and cloning.5 conceptsOpens with credits
- Structural patternsThe seven Gang of Four patterns about how objects fit together: translating interfaces, splitting two dimensions, trees, wrappers, simple front doors, shared state and stand-ins.7 conceptsOpens with credits
- Behavioural patternsThe eleven Gang of Four patterns about how objects share work and talk to each other: passing requests along, packaging actions, swapping algorithms, reacting to events and walking structures.11 conceptsOpens with credits
- UML and class diagrams you actually needThe small part of UML that working engineers sketch: class boxes, visibility, the five relationship arrows, multiplicity and a sequence diagram. Enough to explain a design on a whiteboard or in a pull request.7 conceptsOpens with credits
- Refactoring and code smellsChanging the structure of code without changing what it does, in small safe steps behind tests. Smells tell you where to look; named refactorings tell you what to do.9 conceptsOpens with credits
- Designing small systems end to endLow level design: turning a short problem statement into classes, relationships and working code. A repeatable method, then the classic practice problems and what each one teaches.7 conceptsOpens with credits
- Code review: giving and taking itReviews are where design skill is taught and tested day to day. What reviewers look for, how to write comments people act on, and how to receive them without taking them personally.5 conceptsOpens with credits
- 11Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.124 terms
About this sheet
OOP, SOLID, design patterns, refactoring.
Related on Sefism
Picked from the other libraries by shared topics.
Roadmaps
See allBest practices
See all- Python Best PracticesWrite Python that stays maintainable: supported versions, pyproject and lockfiles, Ruff, type hints, errors, logging, concurrency, pytest and security.
- TypeScript Best PracticesModern TypeScript best practices for 2026: strict settings, TypeScript 7, modeling data with unions, safe narrowing, runtime validation, generics and typed linting.
- Secure Coding Best PracticesWrite code that resists attack: untrusted input, validation, parameterized queries, output encoding, safe parsing, uploads, SSRF and errors that fail closed.
Checklists
See all- Pull Request Checklist: Before You Open a PRA pull request checklist to run before you ask for review: scope and size, a clean diff, tests, a clear description, safe releases and a tidy branch, each with a way to verify it.
- Career Switch into Tech ChecklistMove into software from another field step by step: choose a direction, follow a learning plan, build proof of skill, use your previous domain, network, plan your runway and target a first role.
Project structures
See all- Python package and CLI project structureA command line tool published to PyPI, laid out the way the Python Packaging User Guide and uv recommend: a src layout, one pyproject.toml for metadata and every tool, a thin Typer CLI over plain, testable modules, and releases uploaded by GitHub Actions with trusted publishing. The example is mdlinks, a tool that finds broken links in Markdown files. For students who have written Python scripts and want to ship one that strangers can
pip install. - TypeScript npm library project structureA small, typed npm package (a retry helper) built the way modern libraries ship in 2026: TypeScript source in
src, bundled by tsdown intodistwith type declarations and anexportsmap, tested with Vitest, checked with publint and Are the Types Wrong, versioned with Changesets and published from CI with npm provenance. For students who want to publish their first package, and for anyone whose package works locally but breaks for users. - Flutter project structureFor anyone building one Dart app for Android, iOS and the web. The tree starts from what flutter create gives you and grows into a feature-first lib/ folder, where each feature keeps its own data, domain and presentation code, then adds tests at every level, flavors, release signing, crash reporting and, for large teams, a melos workspace of local packages.
Career questions
See all- What should I learn first to become a software engineer in 2026?Learn one language properly, then Git, the command line, how the web works and basic SQL, and build small things with them from week one. AI tools change how you write code, not what you need to understand. Pick a direction only after the foundations feel boring.
- Should I learn Python or JavaScript first?Choose based on what you want to build. JavaScript if you want web development, since it runs in every browser. Python if you are drawn to data, AI, automation or backend scripting. Both are excellent first languages, and the second one is far easier once you know the first well.
- I understand tutorials but cannot build anything myself. Why does coding feel so different when I am alone?Tutorials train recognition, not production. When you follow along, someone else makes every decision. Building alone requires you to break a problem down and make choices, which is a separate skill. Build it with small projects, planning on paper first, and a rule to struggle before you look anything up.
Cheat sheets
See all- Design Patterns cheat sheetAll 23 Gang of Four patterns with intent, when to use and a TypeScript sketch, plus SOLID, related principles and a problem to pattern map.
- Programming foundations cheat sheetFirst language, Git, CS basics.
- TypeScript cheat sheetTypes, inference, narrowing, generics, type-level tools and strict configuration for real TypeScript codebases.
Work with me
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
- 1:1 Mentorship
- Fresh Graduate Mentorship
- Career Guidance
Brand deals, promos and partnerships: tauseeffayyaz@gmail.com