Skip to content

Instantly share code, notes, and snippets.

@tuannguyenssu
Created July 7, 2019 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuannguyenssu/4e799b2e1e6a6740a4b00b8c18102b28 to your computer and use it in GitHub Desktop.
Save tuannguyenssu/4e799b2e1e6a6740a4b00b8c18102b28 to your computer and use it in GitHub Desktop.
// Class Helper vi phạm SRP
public class Helper
{
public string GetUser();
public DateTime GetCurrentTime();
public string GetCurrentLocation();
public DbConnection GetDatabaseConnection();
}
// Cải thiện class Helper bên trên bằng cách chia nhỏ thành các helper nhỏ hơn
public class UserHelper
{
public string GetUser();
}
public class TimeHelper
{
public DateTime GetCurrentTime();
}
public class LocationHelper
{
public string GetCurrentLocation();
}
public class DatabaseHelper
{
public DbConnection GetDatabaseConnection();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment