Code review#14
Open
JamesB05 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are some comments in this code, however I think adding a summary and more detailed comments are needed to improve readability.
The check to see if the file exists is done well and will handle any related errors accordingly. On the other hand, there are no other error checks, I would suggest adding a check to see if the user has made a valid input, as without one this could cause the code to crash if the user leaves the string empty.
The code is straightforward and simplistic. For improved modularity, i think you would benefit from using more OOP structures like classes as having everything in Main() can cause the code to become hard to reuse and test in the future. Separating the code also allows new features like saving results to be added much easier.
Variable names are descriptive and follow camelCase conventions, this greatly helps with the codes readability.
the code does check to see if the file exists, however it does not account for if the file is readable or formatted properly. Using StringSplitOptions.RemoveEmotyEntries would improve the way the code splits while also avoiding empty strings in the word arrays.
The code outputs in alphabetical order as intended, it also shows total unique words clearly. However it is very simplistic. All I would suggest is some formatting for readability.
The cide uses Regex correctly yo remove punctuation. It also converts to lower case allowing for case-insensitive counting. The code uses a dictionary appropriately to count the words in the file, and the splitting is good for typical text files. Overall the program logic is well integrated.