class Box { public int Height { get; set; } public int Width { get; set; } } これがドメインモデル貧血症
class Box { public int Height { get; } public int Width { get; } public Box(int height, int width) { if (height <= 0) { throw new ArgumentOutOfRangeException(nameof(height)); } if (width <= 0) { throw new ArgumentOutOfRangeException(nameof(width)); } Height = height; Width = width; } public int Area() { return Height * Width; } } これがオブジェクト指向