Skip to content

Conversation

@stillwearit
Copy link

No description provided.

@KFalcon2022 KFalcon2022 self-assigned this Feb 4, 2025
Copy link
Owner

@KFalcon2022 KFalcon2022 left a comment

Choose a reason for hiding this comment

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

Замечание в целом небольшое, но важное. Декомпозиция - важный навык, который стоит развивать с самого начала

int[] objectCounts = new int[radars.length];
for (int i = 0; i < radars.length; i++) {
int object = 0;
if (radars[i].length != 3 || radars[i][2] < 1) {
Copy link
Owner

Choose a reason for hiding this comment

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

валидацию стоит отделять от остальной логики. Во-первых, это улучшит читабельность, во-вторых, ты лишишься риска обработать почти весь массив данных и лишь в конце узнать, что они не валидны

}

objectCounts[i] = object;

Copy link
Owner

Choose a reason for hiding this comment

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

лишняя пустая строка

}

for (int j = 0; j < objectLocations.length; j++) {
if (!isValidObjects(objectLocations[j])) {
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