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

Д/З к семинару 1 #7

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

Conversation

Saidjalol-Sodikov
Copy link

No description provided.

- Реализовал для Human конструкторы, геттеры, сеттеры, и переопределил toString;
- Реализовал для Human конструкторы и переопределил toString;
- Реализовал для Human конструкторы, геттеры, сеттеры, и переопределил toString;
- Реализовал для Human конструкторы и переопределил toString;
…сти от пола при меняются соответсвующие значения и в самих вызовах.

- Создал 6 экземпляров класса типа Human.
- Добавил метод поиска по имени;
- Исправил ошибки.
Comment on lines 47 to 64
public Human(String name, LocalDate dob, Gender gender, List<Human> children, Human mother, Human father) {
this.name = name;
this.dob = dob;
this.gender = gender;
this.children = children;
this.mother = mother;
this.father = father;
}

public Human(String name, LocalDate dob, Gender gender) {
this.name = name;
this.dob = dob;
this.gender = gender;
Human temp1 = new Human();
Human temp2 = new Human();
this.mother = temp1;
this.father = temp2;
}
Copy link
Owner

Choose a reason for hiding this comment

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

нарушение принципа DRY

Copy link
Owner

Choose a reason for hiding this comment

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

И не нудо в 60 строчке создавать человека. Пусть null остается

Comment on lines 70 to 72
public Human(){
this(null);
}
Copy link
Owner

Choose a reason for hiding this comment

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

Максимально странная запись)) Почему вы решили имя сделать null, а все остальное не делать null? По факту и так все поля изначально имеют значение null

", dod=" + dod +
", gender=" + gender +
", children=" + getChildrenNames() +
", mother='" + this.getMother().getName() +
Copy link
Owner

Choose a reason for hiding this comment

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

А) вот для чего вы хотели, чтобы родители были хотя бы пустым Human объектом) можно делать проверку на null

Comment on lines 38 to 46
private String getLikeTable (List<Human> familyList){

return null;
}

private String getLikeTree (List<Human> familyList) {

return null;
}
Copy link
Owner

Choose a reason for hiding this comment

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

?)

Saidjalol-Sodikov and others added 16 commits April 4, 2024 10:35
+ gitignor изменён;
- куча ошибок.
Всё сделано как в семинаре, но без статичного метода тестового дерева. Данные для теста, загружаются из файла "tree.sav".
Всё сделано как в семинаре, но без статичного метода тестового дерева. Данные для теста, загружаются из файла "tree.sav".
- добавил компараторы для возраста и имени.
# Conflicts:
#	src/ru/gb/family_tree/Main.java
#	src/ru/gb/family_tree/human/Human.java
#	src/ru/gb/family_tree/writer/tree.sav
- Сделал класс Tree параметризованным;
- Изменил остальную часть кода, чтобы работало;
- Переименовал переменные и итератор в соответсвии с их назначением.
- добавил общую структуру MVP.
+ Реализовал почти весь полезный функционал семейного древа на основе MVP;
+ Есть возможность сохранения и загрузки древа;

- Не прописана, почти нигде "Защита от дурака" и другие исключения;
- Нет возможности удаления человека из древа;
+ Реализовал почти весь полезный функционал семейного древа на основе MVP;
+ Есть возможность сохранения и загрузки древа;
+ Исправил синтаксические ошибки.

- Не прописана, почти нигде "Защита от дурака" и другие исключения;
- Нет возможности удаления человека из древа;
- Нет реализована возможность контроля за несколькими древами.
Заприватил поля.
- Исправил замечания к прошлому PR.
- Исправил замечания к прошлому PR.
+ Попробовал реализовать принципы SOLID в проекте. Кажется получились, если не брать в счёт исключения.
} else if (viewGender == ViewGender.FEMALE) {
gender = Gender.FEMALE;
}
service.addHuman(name, LocalDate.of(year, month, day), gender);
Copy link
Owner

Choose a reason for hiding this comment

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

странно, что именно презентер занимается созданием даты. Логичней было бы в модели или во view

Copy link
Owner

Choose a reason for hiding this comment

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

Тоже самое касается пола. Либо это вопрос корректного ввода и тогда это view, либо это работа с информацией и тогда это модель

public class Service {
private int genId;
private Tree<Human> tree;
private final FileHandler fH;
Copy link
Owner

Choose a reason for hiding this comment

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

Нарушает пятый принцип солид. Должна быть зависимость от интерфейса

- Исправлен класс Presenter по замечанию.
- Исправлен класс Presenter по замечанию.
- Реализовал принцип "D" в модели.
- Переименовал некоторые методы по назначению.
Надеюсь всё верно.

public HumanFamilyTree() {
tree = new Tree<>();
fH = new FileHandler();
Copy link
Owner

Choose a reason for hiding this comment

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

Надо было передать через аргументы конструктора Writable или через сеттер и тогда упоминаний FileHandler не было бы

if ((findByID(parentID) != null) && findByID(childID) != null){
findByID(parentID).addChild(findByID(childID));
} else {
System.out.println("Данные ID не существуют.");
Copy link
Owner

Choose a reason for hiding this comment

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

Вывод текста пользователю должна осуществлять view

- Исправил крайние замечания.
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