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

Создана база семейного древа. #16

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

Conversation

slansaf
Copy link

@slansaf slansaf commented May 15, 2024

No description provided.

}

public Human(String name, Gender gender) {
this(name, gender, LocalDate.of(1900,12,12));
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 9 to 10
private List<Human> children;
private Human father, mather;
Copy link
Owner

Choose a reason for hiding this comment

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

Ни в какой момент не изменяется состояние этих полей

return false;
}

public boolean remuve(long humansId){
Copy link
Owner

Choose a reason for hiding this comment

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

опечатка в названии

getHumanInfo();
}

public void addChildren(int nameParent, int nameChild) {
Copy link
Owner

Choose a reason for hiding this comment

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

странно, что переменная называется nameParent и при этом имеет тип int

Copy link
Author

Choose a reason for hiding this comment

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

Хотел по имени добавлять родителей, потом вспомнил, имена могут повторяться.

import java.util.List;

public class Service {
private FamilyTree familyTree;
Copy link
Owner

Choose a reason for hiding this comment

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

угловые скобочки и тип Human


public class Service {
private FamilyTree familyTree;
private String filePath = "src/ru/gb/family_tree/model/save/tree.txt";
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 26 to 28
public void addChildren(int nameParent, int nameChild){
familyTree.getById(nameParent).addChild(familyTree.getById(nameChild));
}
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 +30 to +33
public String getHumanInfo(){
String answer = familyTree.getInfo();
return answer;
}
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 51 to 59
private static FamilyTree load(String filePath){
Writable writable = new FileHandler();
return (FamilyTree) writable.read(filePath);
}

private static void save(FamilyTree familyTree, String filePath){
Writable writable = new FileHandler();
writable.save(familyTree, filePath);
}
Copy link
Owner

Choose a reason for hiding this comment

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

Убрать статику. Сделать обычным методом. Writable сделать полем. Убрать нарушение 5 принципа. Зависимость должна быть от абстракции

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