Skip to content

Code Review#15

Open
Tiwi71 wants to merge 1 commit into
cfrantzidis:masterfrom
Tiwi71:master
Open

Code Review#15
Tiwi71 wants to merge 1 commit into
cfrantzidis:masterfrom
Tiwi71:master

Conversation

@Tiwi71

@Tiwi71 Tiwi71 commented Jul 30, 2025

Copy link
Copy Markdown

Code does what it should, which is nice. Would be helpful if variables were more clearly named and commenting was utilised so that someone viewing the code could gain an idea on what it does more easily, rather than having to parse and understand each line.

Linguistic decisions could be improved. 'gimmefile' is a potentially confusing instruction, potentially leading the user to just write 'x.txt' which would not work. 'Please enter the file directory' would be a clearer instruction. 'Done' is an acceptable way of explaining to the user that the file had been read and ran through the program, but something like 'File read and parsed' would be clearer. 'Uniquez' could be replaced with 'number of unique words:' for better user understanding.

The error handling of the code could also be improved. If the user inputs something that isn't a file directory, or simply presses 'enter' without typing anything, an exception error occurs and the program crashes. Error handling components would be helpful, with a line to the user about the input not being valid.

More options would be also be useful. Whilst the user may want the words to be listed in file order, having options to order them by frequency or alphabetically would be convenient.

When you click 'Copy as Path' for the txt file in File Explorer, Windows automatically encases it with "", so having a few lines that remove those would be useful to reduce user difficulties.

Even if the program succeeds, reads the text file and parses it correctly, it would be useful if it would loop and prompt the user if it wants to run another file. That way, if the user wishes to see the word frequency of multiple files, they don't have to start up the program every time.

More OOP principles could also be applied. Whilst the code doesn't do a lot, so all of it being inside 'static void Main' is potentially acceptable, it poses issues if you wish to expand the program to analyse the file in different ways and produce different outputs. Having different functions, such as the dictionary and trimming lines/whitespace, in their own classes which Main then calls upon would stop Program.cs from becoming bloated and difficult to navigate. A polymorphic function for converting different text file contents into the same format for the program to use would be also be helpful, as the program only works for .txt files.

Overall a decent code,. It could just do with more readability, error handling, and easy to implement user options. If you want to expand it to do more, please apply the OOP principles I've described!

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