Skip to content

Решение задачи - #1

Open
robotdorog wants to merge 21 commits into
mainfrom
Cryptor
Open

Решение задачи#1
robotdorog wants to merge 21 commits into
mainfrom
Cryptor

Conversation

@robotdorog

Copy link
Copy Markdown
Owner

No description provided.

Comment thread .idea/misc.xml
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Файлы из .idea не исчезли, посмотри пример в предыдущем репозитории

Comment thread src/main.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
str = reader.readLine();

} catch (Exception e) {
e.printStackTrace();

@rs-pluss rs-pluss Oct 3, 2021

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Исключения, которые не можешь обработать, надо пробрасывать выше

Comment thread src/Cryptor.java
… и reader. Убрал из класса Cryptor пути. Пути принимаются в параметрах метода
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/Cryptor.java Outdated
Comment thread src/CryptorTest.java Outdated
Comment thread src/FileHandlerV2.java Outdated
Comment thread src/CryptorV2.java Outdated
@@ -0,0 +1,60 @@
public class CryptorV2 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Очень много общего между Cryptor и CryptorV2, как можно выделить общую идею?

Comment thread src/CryptorViaString.java
Comment thread src/FileHandler.java Outdated

String fileIn;
String fileOut;
CryptorViaString cryptorViaString;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Этих ребят здесь не должно быть

Comment thread src/TestClass.java Outdated

public class TestClass implements Crypt {

public TestClass(CryptorViaString cryptorViaString, CryptorViaStringBuilder cryptorViaStringBuilder){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Почему пустой конструктор? Ты должен обе этих переменных запомнить в поля класса

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Исправил

Comment thread src/Crypt.java
@@ -0,0 +1,4 @@
public interface Crypt {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Crypt - глагол если я не ошибаюсь, этот интерфейс у тебя описывает сервис. Поэтому здесь должно быть существительное - Cryptor

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Переименовал на Cryptor

Comment thread src/Cryptor.java
@@ -0,0 +1,40 @@
import java.io.IOException;

public class Cryptor implements Crypt {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Это сервис и для него правильно - Cryptor. Только вот он же не просто шифровальщик а с некоторой изюминкой, надо отразить это в названии.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Переименовал на CryptorWithTimeAssessment

Comment thread src/Cryptor.java
CryptorViaStringBuilder cryptorViaStringBuilder;

public Cryptor(CryptorViaString cryptorViaString, CryptorViaStringBuilder cryptorViaStringBuilder) {
this.cryptorViaString = cryptorViaString;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не вижу чтобы ты его использовал и сравнивал время выполнения. Сейчас ты используешь только второй

Comment thread src/FileHandler.java
import java.nio.file.Path;

public class FileHandler {
Cryptor cryptor;

Copy link
Copy Markdown

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