mirror of
https://github.com/ivanpaulovich/clean-architecture-manga.git
synced 2025-01-08 11:57:36 +08:00
Page:
Encapsulation
2
Encapsulation
tanukus edited this page 2020-05-17 22:52:31 -04:00
Given a class, the sum of its members complexity should be less than the sum of its parts in isolation.
Suppose there is a Customer
entity like this:
public class Customer
{
public Guid Id { get; set; }
public string Name { get; set; }
public string SSN { get; set; }
public bool Active { get; set; }
public string ActivatedBy { get; set; }
}
The complexity of the previous class is the same if there were variables like the following:
Guid Id;
string Name;
string SSN;
bool Active;
string ActivatedBy;
Classes that are similar to a bag of data leaks unnecessary complexity. Consider reducing the complexity with something like:
public class Customer
{
public Guid Id { get; protected set; }
public string Name { get; protected set; }
public string SSN { get; protected set; }
public bool Active { get; protected set; }
public string ActivatedBy { get; protected set; }
}
Index of Clean Architecture Manga
Home
Use Cases
Flow of Control
Architecture Styles
Design Patterns
Domain-Driven Design Patterns
- Value Object
- Entity
- Aggregate Root
- Repository
- Use Case
- Bounded Context
- Entity Factory
- Domain Service
- Application Service
Separation of Concerns
Encapsulation
Test-Driven Development TDD
Fakes
SOLID
- Single Responsibility Principle
- Open-Closed Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Dependency Inversion Principle
.NET Core Web API
- Swagger and API Versioning
- Microsoft Extensions
- Feature Flags
- Logging
- Data Annotations
- Authentication
- Authorization
Entity Framework Core
Environment Configurations
DevOps
- Running the Application Locally
- Running the Tests Locally
- Continuous Integration & Continuous Deployment