-
Notifications
You must be signed in to change notification settings - Fork 276
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
Муканов Арман #223
base: master
Are you sure you want to change the base?
Муканов Арман #223
Conversation
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.
Как считаешь можно ли хранить файлы в директории с кодом?
Если нет, то какое решение можно придумать?
Если да, то почему?
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.
Думаю, это не очень хорошая практика. Возможные решения:
- Выделить директорию в проекте
- Хранить файлы в отдельном репозитории/пространстве
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.
Давай назовём папку а-ля assets/images resources/images и также присвоим названия картинкам более осмысленные?
cs/TagsCloudVisualization/README.md
Outdated
![plot](./TagCloud2.jpeg) | ||
|
||
![plot](./TagCloud3.jpeg) | ||
|
||
![plot](./TagCloud4.jpeg) |
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.
Как считаешь нужен ли уникальный alt у изображений?
Стоит ли подумать о caption или он не нужен?
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.
Alt отображается в случае, если изображение не может быть показано. Он поможет понять, что было на изображении, поэтому его стоит использовать.
Caption тоже будет полезным, потому что caption даёт дополнительную информацию об изображении и контексте.
|
||
public void SaveImage(string file, ImageFormat format) | ||
{ | ||
bitmap.Save(file, format); |
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.
Какие есть идеи в случае появления ошибок в 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.
try catch...
} | ||
} | ||
|
||
public void SaveImage(string file, ImageFormat format) |
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.
Как считаешь нужен ли тут String
?
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.
Думаю, что нужен, потому что будет неочевидно, куда сохраняется изображение
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.
Речь про string
vs String
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.
string
- это же просто alias для String
. Поэтому я не вижу преимуществ в использовании String
using var g = Graphics.FromImage(bitmap); | ||
using var brush = new SolidBrush(Color.White); | ||
|
||
var pen = new Pen(brush, 3); ; |
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.
Есть ли решение по поводу магического числа 3?
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.
Инкапсулировать в свойство.
|
||
public class LayouterVisualizer | ||
{ | ||
private readonly Bitmap bitmap; |
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.
Что думаешь насчёт применения свойств здесь?
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.
Думаю стоит переделать под свойство. Это даст больше гибкости будущем. Можно выполнять дополнительные действия при обращении или изменении объекта.
Дедлайн продлён на неделю по просьбе @MNYOU |
} | ||
} | ||
|
||
public void SaveImage(string file, ImageFormat format) |
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.
Речь про string
vs String
cs/TagsCloudVisualization/Tests.cs
Outdated
namespace TagsCloudVisualization; | ||
|
||
[TestFixture] | ||
public class Tests |
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.
Стоит иметь на каждый класс свой отдельный файл тестов
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 void Dispose(bool fromDisposeMethod) | ||
{ | ||
if (isDisposed) return; |
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 (isDisposed)
{
return;
}
или
if (isDisposed) return;
или
if (!isDisposed)
{
...
}
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.
2 вариант, на мой взгляд лучше. Более читаемый, отсутствует вложенность.
} | ||
|
||
currentAngle += GetAngleStep(); | ||
if (currentAngle > Math.PI * 2) |
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.
Лучше в отдельные функции унести содержимое условий
А для чисел завести константы
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.
ок
старое место - Tests.cs новое место - CircularCloudLayouter_Should
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.
Давай уберем пробелы в названиях файлов картинок и вольем
@the_homeless_god