// [S]OLID - Single Responsibility Principle // - a class should have only a single responsibility static void Main(string[] args) { StandardMessages.WelcomeMessage(); IPerson user = PersonDataCapture.Capture(); bool isUserValid = PersonValidator.Validate(user); if (!isUserValid) { StandardMessages.EndApplication(); } AccountGenerator.CreateAccount(user); StandardMessages.EndApplication(); }
static void Main(string[] args) { UserAccount userAccount = UserAccountDataCapture.CaptureFirstName(); userAccount = UserAccountDataCapture.CaptureLastName(); bool isUserAccountValid = UserAccountValidator.Validate(userAccount); if (!isUserAccountValid) { StandardMessages.EndApplication(); return; } AccountGenerator.CreateAccount(userAccount); StandardMessages.EndApplication(); }
public static void Main(string[] args) { StandardMessages.WelcomeMessage(); var user = PersonDataCapture.Capture(); // same as PersonValidator.Validate(user) == false if (!PersonValidator.Validate(user)) { StandardMessages.EndApplication(); return; } AccountGenerator.CreateAccount(user); StandardMessages.EndApplication(); }
static void Main(string[] args) { StandardMessages.WelcomeMessage(); //Ask for person information Person person = PersonDataCapture.Capture(); //check for valid detail bool isPersonValid = PersonValidator.Validate(person); if (isPersonValid == false) { StandardMessages.EndApplication(); return; } //create person AccountGenerator.CreateAccount(person); StandardMessages.EndApplication(); }