Articles
Practical, deeply explained engineering writing — free to read, no sign-up required.
All Articles
SOLID - Open/Closed Principle
Open/Closed Principle, the second principle in SOLID. It says that software entities should be open for extension but closed for modification. This means we should be able to add new features without repeatedly changing existing, tested code. It is useful in payment systems, notification services and other applications that support different implementations.
SOLID - Single Responsibility Principle
A responsibility means a specific job that a class performs. We use this principle when designing classes, services and enterprise applications. It helps us keep software easier to understand, maintain and test.
SOLID Principles Introduction
SOLID is a group of five design principles that help developers write maintainable, flexible and reusable code.
File Handling and JSON Serialization in C#
When our application runs, all data lives in RAM and disappears when the program closes. To keep user profiles, game scores, or settings across sessions, we convert our objects into text using serialization and write them into files on disk.
IDisposable, Using Statement and Resource Management
Applications use resources such as files, database connections, and network streams. These resources should be released when we finish using them. Otherwise, they may remain occupied longer than needed.
Records vs Classes and Tuples in C#
All three help us group related data, but they behave differently. A class is useful for objects with identity and behaviour. A record is designed for data-focused objects with value-based equality. A tuple is useful when we need to group a few values temporarily without creating a separate type.
Pattern Matching in Modern C#
Pattern matching allows us to check a value against a particular condition or type and execute code based on the result.
Properties and Indexers – Get, Set, Init and Required
A property provides controlled access to a class field. A field stores data directly, whereas a property allows us to control how that data is read or modified.
Partial Classes, Sealed Classes and Static Classes
Partial classes help organise large classes across multiple files. Sealed classes prevent inheritance. Static classes allow us to group reusable methods and properties without creating objects.
Readonly vs Const in C#
Both are used to prevent a field's value from being changed, but they work differently. A const value is fixed during compilation. A readonly field can be assigned at declaration or during object construction. We commonly use them for fixed application values, configuration and settings.
Struct vs Class in C#
Both help us create custom types, but they behave differently when assigned, passed to methods or stored in collections. Choosing the right one helps us write efficient and maintainable applications.
Nullable Types and Null Handling in C#
Sometimes a variable may not have a value. For example, a customer may not have provided a date of birth. C# provides nullable types and special operators to handle such situations safely. These features are useful when working with databases, APIs and user input.