Skip to content

Зубков Артём#280

Open
artem7841 wants to merge 11 commits intokontur-courses:masterfrom
artem7841:master
Open

Зубков Артём#280
artem7841 wants to merge 11 commits intokontur-courses:masterfrom
artem7841:master

Conversation

@artem7841
Copy link

Copy link

@Yrwlcm Yrwlcm left a comment

Choose a reason for hiding this comment

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

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

С точки зрения написания кода - не очень, он очень неконсистентный, тут пишешь так, там эдак. Лучше определится со стилистикой написания и писать в одном стиле, пусть даже неправильном, чем чередовать

Comment on lines 409 to 413
Point newCenter = new Point(x, y);
layouter = new CircularCloudLayouter(newCenter);
var newRecSize = new Size(30, 10);

Rectangle rectangle = layouter.PutNextRectangle(newRecSize);
Copy link

Choose a reason for hiding this comment

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

А почему ты чередуешь var и явное указание типа? Хорошей практикой считается везде писать var-ы, за исключениями, когда компилятор сам тебе не даст написать var из-за того что не сможет определить тип

};
}

public Point GetRectangleCenter(Rectangle rectangle)
Copy link

Choose a reason for hiding this comment

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

У нас этот метод дублируется в в Layout-ере и в тестах, и кажется не должен относится ни к тому ни к другому. Если в изначальном классе такого нет, можно написать экстеншен метод

{
center = new Point(0, 0);
layouter = new CircularCloudLayouter(center);
imagePath = Path.Combine(TestContext.CurrentContext.TestDirectory, $"{TestContext.CurrentContext.Test.Name}_cloude.png");
Copy link

Choose a reason for hiding this comment

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

nit: Тут и в других местах поправь cloude на cloud

Comment on lines 16 to 19
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Copy link

Choose a reason for hiding this comment

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

А это зачем?


private bool IsIntersectingWithOtherRectangles(Rectangle rectangle)
{

Copy link

Choose a reason for hiding this comment

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

Приберись в отступах в коде: в начале методов, в конце методов не должно быть пустых строк. Между методами должна быть 1 пустая строка. Да и я не смог вспомнить ситуаций, где две пустые строки подряд выглядели бы норм, их тоже стоит схлопнуть в одну

for (int j = i + 1; j < rectangles.Length; j++)
{

rectangles[i].IntersectsWith(rectangles[j]).Should().BeFalse(rectangles[i] + " " + i + " and " + rectangles[j] + " " + j + " intersect");
Copy link

Choose a reason for hiding this comment

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

Строчка сильно вылазит за один экран, разбей на две

public double GetTotalAreaOfRectangles(Rectangle[] rectangles)
{
int totalAreaOfRectangles = 0;
for (int i = 0; i < rectangles.Length; i++)
Copy link

Choose a reason for hiding this comment

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

Почему тут не foreach?

return result;
}

public void GenerateImage(String pathToSave)
Copy link

Choose a reason for hiding this comment

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

Генерация картинок - не зона ответственности CircularCloudLayouter, должен быть другой класс, который умеет рисовать набор прямоугольников, CircularCloudLayouter должен только возвращать их набор.

Соответственно и тесты на генерацию нужно будет утащить в другой файл с тестами

return new Point(x, y);
}

public Rectangle PutNextRectangle(Size rectangleSize)
Copy link

Choose a reason for hiding this comment

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

Публичные методы должны располагаться над приватными

Copy link

Choose a reason for hiding this comment

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

Такие файлы тоже лучше не коммитить, только если есть конвенты на это в команде (и то, скорее настройки конфигурации ide будут где-то лежать в другом командном месте месте)

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