You have an instance variable used by few methods - reidev275/SignsYouShouldProbablyRefactor GitHub Wiki
Example
class CustomerManager
{
ICustomerRepository _customerRepository;
ICustomerBiller _biller;
void Create(Customer customer)
{
_customerRepository.Insert(customer);
}
void Update(Customer customer)
{
_customerRepository.Update(customer);
}
void BillCustomer(Customer customer)
{
_biller.Bill(customer.Id);
}
}
Why is this bad?
- The class in question could probably be broken into multiple classes to avoid a Single Responsibility Principle violation.
- In this case
BillCustomer
probably shouldn't be part of this class at all.