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

Овечкин Илья #220

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

Conversation

magnat0
Copy link

@magnat0 magnat0 commented Dec 5, 2023

@a_zhelonkin

@magnat0 magnat0 changed the title realization TagsCloudVisualization and write test in TagsCloudVisuali… Овечкин Илья Dec 5, 2023
{
public class CircularCloudLayouter
{
private List<Rectangle> rectangles;

Choose a reason for hiding this comment

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

Лучше ICollection, если возможно. Это позволит при необходимости поменять реализацию не опасаясь потери обратной совместимости

public class CircularCloudLayouter
{
private List<Rectangle> rectangles;
private Point center;

Choose a reason for hiding this comment

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

Никогда не присваивается, мб и не нужно

Comment on lines 10 to 12
private List<Rectangle> rectangles;
private Point center;
private Spiral spiral;

Choose a reason for hiding this comment

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

Всё это readonly

return nextRengtanle;
}

public List<Rectangle> Rectangles => rectangles;

Choose a reason for hiding this comment

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

Лучше IReadonlyCollection. Это защитить от опасности редактирования листа кем-нибудь снаружи


namespace TagsCloudVisualization
{
public class Spiral

Choose a reason for hiding this comment

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

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

(тут же маленькая опциональная рекомендация - делать все свои классы sealed, если не требуется обратное - такой код работает чуточку быстрее + дважды заставит задуматься, а стоит ли наследоваться от данного класса)


while (true)
{
Point point = new Point(

Choose a reason for hiding this comment

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

Везде где возможно, var

graphics = Graphics.FromImage(image);
}

public void drawCloud()

Choose a reason for hiding this comment

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

Тут конвенция именования пошла куда-то не туда. Должен быть PascalCase

Comment on lines 22 to 37
public void drawCloud()
{
graphics.Clear(Color.White);
foreach (var rect in layouter.Rectangles)
{
graphics.FillRectangle(Brushes.Red, rect);
graphics.DrawRectangle(Pens.Black, rect);
}
graphics.Save();

}

public void saveImage(string fileName)
{
image.Save(fileName);
}

Choose a reason for hiding this comment

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

Есть ли необходимость разделять эти две функции, если они всегда вызываются в паре

Comment on lines 12 to 13
private Bitmap image;
private Graphics graphics;

Choose a reason for hiding this comment

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

Кажется, не должно быть в полях класса

SaveIncorrectResultsToJpg();
}

public static IEnumerable TestCasesForWrongCenterPoint

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