Skip to content

Khramov 2tasks complete, Change pom.xml#39

Open
Tovard7431 wants to merge 1 commit intodemologin:mainfrom
Tovard7431:main
Open

Khramov 2tasks complete, Change pom.xml#39
Tovard7431 wants to merge 1 commit intodemologin:mainfrom
Tovard7431:main

Conversation

@Tovard7431
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.

Даже если приложение очень маленькое все равно его нужно разбивать на понятные пакеты потому что в дальнейшем когда классы будут добавляться должно быть понятно где они должны находиться. Выполнено две задачи есть некоторые замечания поставил оценку Ц

public final int hashEnAlphabet(String letter) {

HashMap<String, Integer> enAlphabet = new HashMap<>();
enAlphabet.put("a", 1); enAlphabet.put("b", 2); enAlphabet.put("c", 3);
Copy link

Choose a reason for hiding this comment

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

Тут лучше сделать строчку а потом циклом из неё заполнить карту

public final String letterEnAlphabet(int hash){

HashMap<Integer, String> enAlphabet = new HashMap<>();
enAlphabet.put(1, "a"); enAlphabet.put(2, "b"); enAlphabet.put(3, "c");
Copy link

Choose a reason for hiding this comment

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

Ну и так везде


if (alphabet.booleanEnAlphabet(x) == true) {
int a = alphabet.hashEnAlphabet(x);
if ((a + key) > 26) {
Copy link

Choose a reason for hiding this comment

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

Числам и строкам лучше присваивать понятные константные имена


public class FileManager {

public List<String> readingFile(String fileAddress) {
Copy link

Choose a reason for hiding this comment

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

Тут всё хорошо но все же не очень понятно почему именно лист

public void writeFile(List<String> list, String encryptedFileAddress) {

try (BufferedWriter writer = new BufferedWriter(new FileWriter(encryptedFileAddress))) {
for (String line : list) {
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.Scanner;

public class MainApp {
public static void main(String[] args) {
Copy link

@Khmelov Khmelov Oct 23, 2025

Choose a reason for hiding this comment

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

Чаще всего в методе main создают все компоненты приложения и/или собирают это приложение, а его запуск выполняется в каком-то понятном методе например старт


public static String fileAddress() {
InputStream stream = System.in;
Scanner console = new Scanner(stream);
Copy link

Choose a reason for hiding this comment

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

Не очень хорошая идея создавать сканер при каждом обращении к методу

public class PathAndKey {


public static String fileAddress() {
Copy link

Choose a reason for hiding this comment

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

Когда методы статические их трудно тестировать

import java.io.InputStream;
import java.util.Scanner;

public class PathAndKey {
Copy link

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