Code review#16
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.
The code is not commented, try including a summary at the top of the code detailing the purpose of the project. There is also an issue with variable names as they are just one letter long, consider adding more meaningful variable names to improve readability (e.g. fileName, wordCounts etc). Also consider adding inline comments explaining each section of the code, this will improve the maintainability of the code in the long run.
The code does not handle errors properly as it always assumes the file exists and is valid, consider adding a check to your code to avoid any errors in the future to avoid runtime errors. such as adding an if loop to check the file exists.
Overall i would suggest a complete change of variable names in the code, this would majorly improve readability. Also adding inline comments to better keep track of what you're working on. The output is functional and works well, but error handling could also be worked on.
4.The program logic performs the intended purpose. However there are no classes or objects used beyond the main program, everything is written in main. On top of that there is no abstraction or encapsulation, i would suggest separating the data and adding encapsulation to the code. this will make the code easier to test, reuse and expand upon.