Top products from r/codereview

We found 1 product mention on r/codereview. We ranked the 1 resulting product by number of redditors who mentioned them. Here are the top 20.

Next page

Top comments that mention products on r/codereview:

u/tannerz28 ยท 1 pointr/codereview

I'll chime in since I'm writing a large-scale bot myself.


First of all, nice job so far. You are making good progress. I've checked on your repo occasionally within the last day, and see that you are continually making improvements. Keep it up!

My suggestion pertains to code style/readability.

  • Don't abbreviate your variable names if you can avoid it. For example, in your `random.js` file, you have this line:

    
    r = Math.random();<br />
    ```<br />
    <br />
    On other lines, it would be ambiguous as to what `r` represents. I'd recommend to always use descriptive identifiers, because it makes your code more readable and maintainable.<br />
    <br />
    An easy fix for this would be to rename the variable to `randomNumber`. It only takes a second to type, but greatly reduces the amount of time it takes to understand your code.<br />
    <br />
    Another example is in `move.js` where you have these two lines:<br />
    <br />
    ```js<br />
    h = false; // no text setting<br />
    g = false; // no move<br />
    ```<br />
    <br />
    In theory, code should be &quot;self-documenting&quot;, meaning you shouldn't *need* a comment to describe what a variable is. In this case, you added comments to basically describe the variable.<br />
    <br />
    To resolve this, just change the variable to be the description of the variable, essentially, like:<br />
    <br />
    ```js<br />
    hasTextSetting = false<br />
    hasMove = false<br />
    ```<br />
    <br />
    With a descriptive variable name (identifiers in general), there is no need to add a comment to describe what the variable does, because the identifier should tell you what it does or holds.<br />
    <br />
    <br />
    If you want to gain a lot of good coding habits, I would highly recommend reading [Clean Code](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882)<br />
    <br />
    <br />
    Otherwise, it looks good so far. If you have any questions about making a bot or need help, feel free to ask me. Contact me on Discord, Joker#3650<br />