-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lesson_1 #36
base: master
Are you sure you want to change the base?
Lesson_1 #36
Conversation
src/Person.java
Outdated
private String name; | ||
private Person father; | ||
private Person mother; | ||
private List<Person> children; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
пол? Дата рождения и смерти?
src/Woman.java
Outdated
@@ -0,0 +1,10 @@ | |||
public class Woman extends Person { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лишний класс. Не используйте наследование только для того, чтобы поменять значение поля
src/IFileOperations.java
Outdated
void saveToFile(String fileName) throws IOException; | ||
void loadFromFile(String fileName) throws IOException, ClassNotFoundException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Метод сохранения должен принимать объект, который надо сохранить, в аргументах метода, а метод загрузки должен возвращать этот объект
} | ||
|
||
public void sortByName() { | ||
Collections.sort(people, PersonComparators.compareByName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
убрать статику. Весь рабочий код перенести сюда
public class FamilyTreePresenter { | ||
private FamilyTreeService service; | ||
private FamilyTreeView view; | ||
private FamilyTreeFileManager fileManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
файловым менеджером должен управлять сервисный класс, а не презентер
switch (choice) { | ||
case 1: | ||
addPerson(); | ||
break; | ||
case 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
свич кейс нарушает второй принцип солид
String name = view.getInput("Введите имя: "); | ||
String gender = view.getInput("Введите пол (М/Ж): "); | ||
String birthDateInput = view.getInput("Введите дату рождения (ГГГГ-ММ-ДД): "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
похоже на логику общения с пользователем, а логика общения с пользователем должна быть во view
System.out.println("\nВыберите действие:"); | ||
System.out.println("1. Добавить человека"); | ||
System.out.println("2. Найти человека"); | ||
System.out.println("3. Показать всех членов семьи"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нарушает второй принцип солид
No description provided.