Skip to content
This repository was archived by the owner on Oct 25, 2021. It is now read-only.

Alexander_Belyaevskov#11

Open
alz-34 wants to merge 23 commits intomasterfrom
feature/AlexanderBelyaevskov
Open

Alexander_Belyaevskov#11
alz-34 wants to merge 23 commits intomasterfrom
feature/AlexanderBelyaevskov

Conversation

@alz-34
Copy link
Collaborator

@alz-34 alz-34 commented Jul 7, 2021

No description provided.

@NikolaevArtem NikolaevArtem added the bug Code fix needed label Jul 9, 2021
@alz-34 alz-34 added the readyForReview Sign for Artem to take a look label Jul 10, 2021
@NikolaevArtem NikolaevArtem removed the readyForReview Sign for Artem to take a look label Jul 11, 2021
@NikolaevArtem NikolaevArtem changed the title add homework_1 Alexander_Belyaevskov Jul 11, 2021
@alz-34 alz-34 added the readyForReview Sign for Artem to take a look label Jul 12, 2021
@NikolaevArtem NikolaevArtem removed the readyForReview Sign for Artem to take a look label Jul 13, 2021
@alz-34 alz-34 added the readyForReview Sign for Artem to take a look label Jul 14, 2021
@NikolaevArtem NikolaevArtem added documentation Documentation fix needed HW_1 Good to go and removed bug Code fix needed readyForReview Sign for Artem to take a look documentation Documentation fix needed labels Jul 15, 2021
@alz-34 alz-34 added the readyForReview Sign for Artem to take a look label Jul 15, 2021
}
}

private void readFromConsole() throws Exception {
Copy link
Collaborator

Choose a reason for hiding this comment

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

SonarLint: Using such generic exceptions as Error, RuntimeException, Throwable, and Exception prevents calling methods from handling true, system-generated exceptions differently than application-generated errors.

String outputString = "x";
for (int i = 0; i < inputInt; i++) {
joiner.add(outputString);
outputString = outputString + "x";
Copy link
Collaborator

Choose a reason for hiding this comment

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

check StringBuilder class

@NikolaevArtem NikolaevArtem removed readyForReview Sign for Artem to take a look style Style fix needed readyForStudentReview labels Sep 21, 2021
public class Main {

public static void main(String[] args) {
new Game().run();
Copy link
Owner

Choose a reason for hiding this comment

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

Good! The game works fine, even though it's not really comfortable to play. I didn't find any bugs, and you show good knowledge and skills using Java Core and Java libraries, Java 8 features as well.

To make better: refactor interface (automatic ship placement, field representation to more comfortable. You chose the easiest approach where fields representation is the same for both players, it could be improved.)
Also, here and there I can see typos and Code Conventions violations in minor things. Not critical, but disturbing.


import java.util.Arrays;

public final class ImmutableTask {
Copy link
Owner

Choose a reason for hiding this comment

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

Well-done!


public class Main {

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

Choose a reason for hiding this comment

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

Good job, nice example!

import java.util.Scanner;
import java.util.stream.Collectors;

public class CustomFileReader {
Copy link
Owner

Choose a reason for hiding this comment

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

Also good and readable

import java.util.UUID;

//has serialization and thread-safety guaranteed by the enum implementation itself
public enum EnumDatabaseConnection {
Copy link
Owner

Choose a reason for hiding this comment

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

Nice example, a good understanding of Java concepts and inner implementation!


public class CustomRegexMatcher {

final private String regex_email = "^[^0-9]\\w+@[^0-9]\\w+(\\.[a-z]{2,3}){1,2}$";
Copy link
Owner

Choose a reason for hiding this comment

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

Nice regex and description

import java.io.InputStreamReader;
import java.math.BigInteger;

public class PowerOfNumber {
Copy link
Owner

Choose a reason for hiding this comment

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

Not a common implementation of recursion, it can be confusing. Well, works anyway


public class MapProblemsCollisionGenerator {

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

Choose a reason for hiding this comment

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

Good example of mutable key problem, but where's the object, that makes 100% collisions in hashMap?


public class Main {

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

Choose a reason for hiding this comment

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

Opt: you could introduce such fields and such lambda, that it will make type conversion as well (as example, weight to size or smth like this)

ImmutableTask task = new ImmutableTask("Immutable class");

ImmutableTask taskAfterChangeName = task.changeName("new name here!!!");
assertNotEquals(task, taskAfterChangeName);
Copy link
Owner

@NikolaevArtem NikolaevArtem Sep 21, 2021

Choose a reason for hiding this comment

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

Opt: Two objects can be equal, but not the same, right? I mean criteria of equality, when we check mutability, might be prone to errors

//Class singleton
assertEquals(DatabaseConnection.getInstance("superAdmin"), DatabaseConnection.getInstance("admin"));
//Enum singleton
assertEquals(EnumDatabaseConnection.INSTANCE.getInstance(), EnumDatabaseConnection.INSTANCE.getInstance());
Copy link
Owner

Choose a reason for hiding this comment

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

Opt: equals is not the same, right?


import static org.junit.jupiter.api.Assertions.assertEquals;

class PowerOfNumberTest extends UnitBase {
Copy link
Owner

Choose a reason for hiding this comment

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

Wrong name

Copy link
Owner

@NikolaevArtem NikolaevArtem left a comment

Choose a reason for hiding this comment

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

Well-done! I approve the HW, but you also need to add fixes to HW_6. You show good knowledge of Java Core, complicated Java concepts and use them where needed, without making the code complicated, it's cool. I would suggest checking your code for typos/unused imports/etc, even though this does not affect implementation, it can cause smelly code in general and lead to bugs later.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants