Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Lesson_1 #36

wants to merge 6 commits into from

Conversation

SevenMax777
Copy link

No description provided.

src/Person.java Outdated
private String name;
private Person father;
private Person mother;
private List<Person> children;
Copy link
Owner

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 {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лишний класс. Не используйте наследование только для того, чтобы поменять значение поля

Comment on lines 7 to 8
void saveToFile(String fileName) throws IOException;
void loadFromFile(String fileName) throws IOException, ClassNotFoundException;
Copy link
Owner

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);
Copy link
Owner

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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

файловым менеджером должен управлять сервисный класс, а не презентер

Comment on lines +27 to +31
switch (choice) {
case 1:
addPerson();
break;
case 2:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

свич кейс нарушает второй принцип солид

Comment on lines +81 to +83
String name = view.getInput("Введите имя: ");
String gender = view.getInput("Введите пол (М/Ж): ");
String birthDateInput = view.getInput("Введите дату рождения (ГГГГ-ММ-ДД): ");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

похоже на логику общения с пользователем, а логика общения с пользователем должна быть во view

Comment on lines +16 to +19
System.out.println("\nВыберите действие:");
System.out.println("1. Добавить человека");
System.out.println("2. Найти человека");
System.out.println("3. Показать всех членов семьи");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нарушает второй принцип солид

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants