-
Notifications
You must be signed in to change notification settings - Fork 0
Sprint 7 solution in file manager #2
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
base: main
Are you sure you want to change the base?
Conversation
avfyodorov
left a comment
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.
Добрый день, Максим!
Так, тут у нас проблема, Похоже, это код от предыдущего спринта. Не нашёл ничего, связанного с работой с файлами.
Посмотрите, пожалуйста.
avfyodorov
left a comment
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.
Добрый день, Максим!
Практически всё сделано, осталось чуть поправить.
| } | ||
|
|
||
| private String toString(Task task) { | ||
| if (task instanceof Subtask) { |
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.
if (task instanceof Subtask) {
instanceof в ООП использовать не приветствуется. Лучше воспользоваться полиморфизмом и спросить у самого обьекта getTaskType.
и с тех. стороны instanceof будет медленней чем getTaskType, т.к. он будет сканировать всю иерархию классов (тип тогда будет совпадать, когда все его родители тоже совпадают).
Можно в классе Task объявить метод:
public TaskType getType() {
return TaskType.TASK;
}А в классах наследниках Epic , Subtask мы можем переопределить
@Override
public TaskType getType() {
return TaskType.SUBTASK;
}Аналогично для эпика. Таким образом, в зависимости от полученного экземпляра класса будет вызван соответствующий метод
Тем более, что такое перечисление (TaskType) уже есть в проекте, а тип задачи записывается в файл с данными.
| save(); | ||
| return addedSubtask; | ||
| } | ||
|
|
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.
Сюда ещё нужно добавить методы delete* update* для всех типов задач. В общем, все методы, которые изменяют содержимое хранилищ.
avfyodorov
left a comment
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.
Добрый день, Максим!
Практически всё сделано, осталось чуть поправить.
Есть просьба - оставлять хоть какую-то реакцию на мои комментарии. Сделано/ Не сделано, потому что не согласен/ Не заметил. 🙂
| super.deleteSubtaskByID(id); | ||
| save(); | ||
| } | ||
|
|
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.
Не забыть реализовать методы с сохранением данных в файл. 🙂
@Override
public void deleteTasks() {
@Override
public void deleteEpics() {
@Override
public void deleteSubtasks() {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.
Сделано
avfyodorov
left a comment
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.