Skip to content

Feature/review#1

Open
AlBrkn wants to merge 2 commits into
mainfrom
feature/review
Open

Feature/review#1
AlBrkn wants to merge 2 commits into
mainfrom
feature/review

Conversation

@AlBrkn

@AlBrkn AlBrkn commented Jul 24, 2022

Copy link
Copy Markdown
Owner

No description provided.

import java.util.Arrays;
import java.util.Scanner;

public class Main {

@AlBrkn AlBrkn Jul 24, 2022

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.

  1. Формат компилируемых файлов должен быть *.java
  2. Класс с точкой входа принято называть Main
  3. Наименование файла должно совпадать с наименованием класса
  4. package подразумевает, что файл находится в директории, а не в корне проекта
  5. Желательно добавлять комментарий к классу в формате
    /* <Что делает класс>
    @autor Имя_Фамилия
    */

import java.util.Scanner;

public class Main {
public static void checkYear(int year) {

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.

наименование checkIsLeap(int year) лучше отражает функциональность

if (deliveryDistance > 20) {
deliveryTime++;
}
if (deliveryDistance > 60) {

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.

условия >20 и >60 перекрывают друг-друга, соответственно
if (deliveryDistance > 60) можно убрать


public static void checkOS(int deviceYear, int clientOS) {
int currentYear = LocalDate.now().getYear();
if (clientOS == 1) {

@AlBrkn AlBrkn Jul 24, 2022

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.

вынести в константы значения, которые отвечают за определение OS
private static final int ANDROID_OS = 0;
private static final int IOS_OS = 1;

}
}

public static void checkOS(int deviceYear, int clientOS) {

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.

предлагаю выделить из данного метода два метода:

  1. метод получения OS - возвращать iOS или Android
  2. метод, который определяет, какое обновление нужно lite-version или full-version
    при этом нужно не забыть про модификаторы доступа

а в основной метод передавать результат выполнения предыдущих двух и печатать информацию через
System.out.println(String.format("Install the %s for %s at the link", typeOfUpdate, osName));

из плюсов- уходим от вложенности if-else.

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.

также нужно переименовать метод т.к. данное название не совсем отображает то, что делает метод

return averageValue;
}

public static double getSum(int[] arr) {

@AlBrkn AlBrkn Jul 24, 2022

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.

сумма целых чисел не может быть вещественным числом. возвращаемым значением должен быть int

}


public static void main(String[] args) {

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.

перенести данный метод в начало класса, так будет проще отследить что делает данный класс

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.

блоки(таски) предлагаю вынести в отдельные методы

return deliveryTime;
}

public static void checkDoubles(String str) {

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.

предлагаю переименовать метод в checkDuplicateCharacter

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.

1 participant