-
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
Д/З к семинару 1 #7
base: master
Are you sure you want to change the base?
Conversation
- Реализовал для Human конструкторы, геттеры, сеттеры, и переопределил toString; - Реализовал для Human конструкторы и переопределил toString;
- Реализовал для Human конструкторы, геттеры, сеттеры, и переопределил toString; - Реализовал для Human конструкторы и переопределил toString;
…сти от пола при меняются соответсвующие значения и в самих вызовах. - Создал 6 экземпляров класса типа Human.
- Добавил метод поиска по имени; - Исправил ошибки.
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; | ||
} |
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.
нарушение принципа DRY
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.
И не нудо в 60 строчке создавать человека. Пусть null остается
public Human(){ | ||
this(null); | ||
} |
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.
Максимально странная запись)) Почему вы решили имя сделать null, а все остальное не делать null? По факту и так все поля изначально имеют значение null
", dod=" + dod + | ||
", gender=" + gender + | ||
", children=" + getChildrenNames() + | ||
", mother='" + this.getMother().getName() + |
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.
А) вот для чего вы хотели, чтобы родители были хотя бы пустым Human объектом) можно делать проверку на null
src/ru/gb/family_tree/tree/Tree.java
Outdated
private String getLikeTable (List<Human> familyList){ | ||
|
||
return null; | ||
} | ||
|
||
private String getLikeTree (List<Human> familyList) { | ||
|
||
return null; | ||
} |
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.
?)
+ 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
- добавил общую структуру MVP.
+ Реализовал почти весь полезный функционал семейного древа на основе MVP; + Есть возможность сохранения и загрузки древа; - Не прописана, почти нигде "Защита от дурака" и другие исключения; - Нет возможности удаления человека из древа;
+ Реализовал почти весь полезный функционал семейного древа на основе MVP; + Есть возможность сохранения и загрузки древа; + Исправил синтаксические ошибки. - Не прописана, почти нигде "Защита от дурака" и другие исключения; - Нет возможности удаления человека из древа; - Нет реализована возможность контроля за несколькими древами.
Заприватил поля.
- Исправил замечания к прошлому PR.
- Исправил замечания к прошлому PR.
+ Попробовал реализовать принципы SOLID в проекте. Кажется получились, если не брать в счёт исключения.
} else if (viewGender == ViewGender.FEMALE) { | ||
gender = Gender.FEMALE; | ||
} | ||
service.addHuman(name, LocalDate.of(year, month, day), gender); |
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
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, либо это работа с информацией и тогда это модель
public class Service { | ||
private int genId; | ||
private Tree<Human> tree; | ||
private final FileHandler fH; |
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.
Нарушает пятый принцип солид. Должна быть зависимость от интерфейса
- Исправлен класс Presenter по замечанию.
- Исправлен класс Presenter по замечанию. - Реализовал принцип "D" в модели.
- Переименовал некоторые методы по назначению.
Надеюсь всё верно.
|
||
public HumanFamilyTree() { | ||
tree = new Tree<>(); | ||
fH = new FileHandler(); |
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.
Надо было передать через аргументы конструктора Writable или через сеттер и тогда упоминаний FileHandler не было бы
if ((findByID(parentID) != null) && findByID(childID) != null){ | ||
findByID(parentID).addChild(findByID(childID)); | ||
} else { | ||
System.out.println("Данные ID не существуют."); |
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
- Исправил крайние замечания.
No description provided.