Skip to content

Create Code review (resit)#7

Open
Sam-H06 wants to merge 1 commit into
cfrantzidis:masterfrom
Sam-H06:patch-1
Open

Create Code review (resit)#7
Sam-H06 wants to merge 1 commit into
cfrantzidis:masterfrom
Sam-H06:patch-1

Conversation

@Sam-H06

@Sam-H06 Sam-H06 commented Jul 28, 2025

Copy link
Copy Markdown

Naming

There's a couple variables in this that have non-descriptive names and make the code more difficult to understand, for example:
program --> WordFrequencyApp
S --> cleanedLine
However overall, this code uses recognisable names such as:
filePath
lines
wordCounts

Code Structure

code is easier to follow when responsibilities are clearly divided.
main(), LoadFile(), cleanText(), countWords(), and DisplayResults() helps understand the flow. On the other hand, the code lacks reusability

Error Handling + File assumptions

only checks if file exists - could check empty files, files that are unreadable, or files that are extremely large.
prevents crashes as it uses Try-Catch blocks which catch unexpected errors and prevent app shutdown.

OOP Principles

-> No encapsulation, all logic is exposed in a single method.
-> No abstraction
-> No polymorphism, all behaviour is hardcoded, no flexibility to swap or extend parts.

Output

code is hard to export results, automate processing, or use in other programs.
gives the user little to no info about the file that was analysed

Program Logic

code is inefficient for large files, as it uses file.ReadAllLines()
loads the entire file into memory - negative for larger files

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