Skip to content

Code Review#4

Open
Jas-mine0 wants to merge 1 commit into
cfrantzidis:masterfrom
Jas-mine0:Jas-mine0-Code-Review
Open

Code Review#4
Jas-mine0 wants to merge 1 commit into
cfrantzidis:masterfrom
Jas-mine0:Jas-mine0-Code-Review

Conversation

@Jas-mine0

Copy link
Copy Markdown

1). "Is the code properly documented/commented?".
The code includes some basic comments saying what the codes does but does not go into depth. In addition to this, the code does not have documentation.

a. "Does it need more work?/Is it great?".
The code could include some more detailed comments explaining why things have been done the way they have and why it is beneficial, so yes, it could use some more work. In my opinion it is not great as it looks very basic but overall it is ok.

b. "Where should it be better?".
The code should be better when it comes to including more detailed comments and including documentation.

2). "Does the code handle errors properly?".
Yes, the code handles errors properly.

a. "Does it need more work?/Is it great?".
No, the code regarding error handling does not need more work and in my opinion it is great.

b. "Where could it be better?".
I personally don't think there's really a way to make the error handling better, as it already handles potential errors, but a "try-catch" could have been included.

  1. "What suggestions do you have to improve the code?".
    Suggestions can be found below in the code review.

Naming issues:
The program is just called "Program" which is the default name for classes.

Naming strengths:
Variable names like filePath, lines, and wordCounts explain themselves and they are consistent with C# naming conventions.

Naming suggestions:
Change the program name from the default "Program" to something else so it is more memorable and descriptive.

Code Structure issues:
User is forced to manually input the file path themselves.

Code Structure strengths:
Dictionary usage is cleanly written, and the use of LINQ for sorting is efficient and readable.

Code Structure suggestion:
Maybe don't force the user to input the file path manually, as the user may not be aware of where the file has actually been stored.

Error Handling issues:
I can't find any issues with error handling.

Error Handling strengths:
The code checks if the file exists before trying to read it, which prevents errors happening if the file could not be found or if it did not exist.

Error Handling suggestion:
I have no suggestions for Error Handling as the program deals with it well.
Maybe a "try-catch" could be used but the code deals with errors well already.

File Assumptions issues:
The program assumes that the file will be a basic file, which is not useful if the file is not a basic file.

File Assumptions strength:
The file is assumed to be a basic text file, which is useful as the file will more than likely be a basic file. Assuming it will be a basic file is understandable and makes sense.
Making the program assume it is a basic file takes less programming time than assuming it isn't a basic text file.

File Assumptions suggestions:
I have no suggestions for the File Assumptions as the program deals with it well.

Object-Oriented Principles issues:
No classes are used beyond the "program" class.
Code has not been split into different files.
The code does not follow the single responsibility principle.

Object-Oriented Principles strengths:
I can't find any strengths for the Obeject-Oriented Principles.

Object-Oriented Principles suggestions:
Add more classes to make the code more efficeint to work through and easier to read.
Split the code into different files as it can be beneifical for efficiency and reusability. edit the code to apply the single responsibility principle.
This is because it makes the code easier to maintain and test, in addition to making the code easierto understand.

Output issues:
I can't find any issues with the output.

Output strengths:
The program outputs the word count and includes the total number of unique words.

Output suggestions:
Maybe allow the user to export the results to a file if they wanted to.

Program Logic issues:
I can't find any issues with the program logic.

Program Logic strengths:
Overall the program's logic makes sense and it is understandable.
LINQ is used in "foreach (var pair in wordCounts.OrderBy(p => p.Key))", which makes the code more efficient and concise.

Program Logic suggestions:
I don't have any suggestions for the program logic.

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