Posts

Showing posts from July, 2018

SOLID Principles with C#

SOLID Principles are coding standards that all developers should have a clear concept for developing software in a proper way to avoid a bad design. S - Single Responsibility Principle (SRP): A class should have one, and only one, a reason to change In Single Responsibility Principle Each class and module should focus on a single task at a time Everything in the class should be related to that single purpose There can be many members in the class as long as they related to the single responsibility With SRP, classes become smaller and cleaner Code is less fragile  Here  UserAccount  class created which have below operations like, Login, Register, LogError and Send Mail. According to SRP, ideally, LogError and SendEmail are should not be part of  UserAccount  operations.      public class UserAccount     {         public bool Login( string username, string password)         {             //Login varification code             return true ;