Skip to content

Baeramshina - 2 tasks complete#33

Open
AnastasiaBaeramshina wants to merge 25 commits intodemologin:mainfrom
AnastasiaBaeramshina:main
Open

Baeramshina - 2 tasks complete#33
AnastasiaBaeramshina wants to merge 25 commits intodemologin:mainfrom
AnastasiaBaeramshina:main

Conversation

@AnastasiaBaeramshina
Copy link

No description provided.

Copy link

@Khmelov Khmelov left a comment

Choose a reason for hiding this comment

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

Приложение не разбито на пакеты есть замечания к реализации. Из четырёх ожидаемых функций реализованы две. Поставил оценку C


import java.util.Scanner;

public class ConsoleReader extends InputReader {
Copy link

Choose a reason for hiding this comment

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

Это правильно сделано



public class ConsoleRunner {
private static String originalText = null;
Copy link

Choose a reason for hiding this comment

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

А вот это неправильно. Во-первых поля и так пустые, а во-вторых статически их делают очень редко



private static void handleReadFile(Scanner console) {
InputReader readFile = new ReadFile("text/dict.txt");
Copy link

Choose a reason for hiding this comment

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

Тут плохо то что путь к файлу указан жёстко


private static void handleEncrypt() {

Map<Character, Character> caesarCipher = LogicEncrypted.createCaesarCipher(5);
Copy link

Choose a reason for hiding this comment

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

Что такое пять догадаться сложно

public static String decryptText(String text, Map<Character, Character> cipherMap) {
StringBuilder result = new StringBuilder();
for (char c : text.toCharArray()) {
if (cipherMap.containsKey(c)) {
Copy link

Choose a reason for hiding this comment

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

Насколько я вижу метод шифрования от метода дешифрования почти не отличается, в таких случаях их лучше объединить в какой-либо абстракции

import java.util.HashMap;
import java.util.Map;

public class LogicDecrypted {
Copy link

Choose a reason for hiding this comment

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

Здесь тоже самое


public enum MenuOption {
READ_CONSOLE("Прочитать с консоли"),
READ_FILE("Прочитать файл"),
Copy link

Choose a reason for hiding this comment

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

Тут видим четыре отдельных команды что в целом неплохо

String line;
while((line =reader.readLine())!=null)

{
Copy link

Choose a reason for hiding this comment

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

Тут что-то не то c форматированием

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