this post was submitted on 03 Dec 2023
9 points (100.0% liked)

Code Review

155 readers
1 users here now

Welcome to the programming.dev code review community! This is a place where you can review other people's code or request reviews on your own

Before posting please read the sections below (click on one to expand it)

What is a code review?

What is a code review?

A code review is a process where people who did not write a piece of code look over it to find errors, suggest improvements, and make sure it follows coding standards

When doing a code review look for these aspects:

  1. Correctness: Does the code behave as expected and meet the requirements?
  2. Readability: Is the code easy to understand and maintain?
  3. Efficiency: Are there more efficient ways to accomplish the same task?
  4. Best Practices: Does the code follow established coding standards and best practices?
  5. Security: Are there potential security vulnerabilities?
  6. Scalability: Will the code perform well as the application scales?

Post Guidelines

Guidelines

  • Put the programming language you used for your code in square brackets ahead of your post title. e.g. [Python], [React], [C#], etc.
  • Provide a link to a spot where people can view your code (e.g. github, etc.) in your post body
  • In your post title put a small description of what the thing is that you want reviewed and then you can expand on that in more details if you want in your post body

Rules

Rules

Any code review requests you post after your first must be done after you have reviewed two other people's code (and then you need another two for each request after that as well).

Youre free to post your first code review request in this community though without needing to follow this


Credits

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient




Wormhole

[email protected]

founded 1 year ago
MODERATORS
 

I wrote a simple algorithm for predictive text that uses preceding words as context. Without looking at prior, it was an attempt as seeing what I could come up with.

The goal is for it to be incorporated in chorded input and pick the best candidate for the entered chord with the given context. Chorded input is the method of hitting all keys for a word simultaneously instead of hitting each key individually in expected order.

E.g you've typed "this is the worst" and hit the chord "aet", which word should be chosen? ate? tea? eta? This algorithm is there to answer that.

What I'm looking for in the code review in order of importance:

  • documentation (is it understandable? are there things missing? ...)
  • code architecture, code structure (function should be a member? composition could be changed? clarity, ...)
  • algorithm review (optimisations, improvements)
  • variable and class names (naming things is hard)
  • rust specific stuff (f64 instead of u32 maybe? dyn vs impl? ...)

The code is linted and automatically formatted.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 2 points 11 months ago (1 children)

Cool! I've given two cents about the code, apologize if there's I said anything, I didn't mean it. English isn't my first language.

[โ€“] tinkralge 1 points 11 months ago

Thank you! I implemented some of the feedback (haven't pushed yet) and responded to the comments. Learned something ๐Ÿ‘