Skip to content

Instantly share code, notes, and snippets.

View Ruthenus's full-sized avatar

Ruslan Kachurovskyi Ruthenus

  • Odesa, Ukraine
View GitHub Profile
@sunmeat
sunmeat / Program.cs
Last active January 13, 2026 18:52
SRP bad example C#
using System.Text;
class Product
{
public string? Name { get; set; }
public decimal Price { get; set; }
// ...
}
class Order
@sunmeat
sunmeat / Program.cs
Last active January 13, 2026 18:56
SRP nice example C#
using System.Text;
class Product
{
public string? Name { get; set; }
public decimal Price { get; set; }
}
class Order
{
@sunmeat
sunmeat / Program.cs
Last active January 13, 2026 18:59
OCP bad example
using System.Text;
class Product
{
public string? Name { get; set; }
public decimal Price { get; set; }
}
class Order
{
@sunmeat
sunmeat / Program.cs
Last active January 13, 2026 20:21
OCP nice example C#
using System.Text;
class Product
{
public string? Name { get; set; }
public decimal Price { get; set; }
}
class Order
{
@sunmeat
sunmeat / Program.cs
Last active January 13, 2026 20:55
LSP bad example C#
using System.Text;
class Product
{
public string? Name { get; set; }
public decimal Price { get; set; }
}
class Order
{
@sunmeat
sunmeat / Program.cs
Last active January 13, 2026 21:26
ISP bad example C#
interface IBird
{
void Fly();
void Tweet();
void Eat();
}
class Sparrow : IBird
{
// ...
@sunmeat
sunmeat / Program.cs
Last active January 13, 2026 21:36
ISP nice example C#
interface IFlyable
{
void Fly();
}
interface IEatable
{
void Eat();
}
@sunmeat
sunmeat / Program.cs
Last active January 13, 2026 22:04
DIP bad example C#
class Worker
{
// ...
public void DoWork()
{
Console.WriteLine("Працівник працює...");
}
}
class Manager
@sunmeat
sunmeat / Program.cs
Last active January 13, 2026 22:07
DIP nice example C#
interface IService
{
void ProvideService();
}
class PizzaDelivery : IService
{
// ...
public void ProvideService()
{
@sunmeat
sunmeat / Program.cs
Last active January 15, 2026 20:46
lazy initialization example C#
using System.Text;
namespace LazyInitializationExample
{
class Program
{
static void Main()
{
Console.OutputEncoding = Encoding.UTF8;
var lazy = new LazyHistory();