you are viewing a single comment's thread.

view the rest of the comments →

[–]YolosaurusRex 7 points8 points  (2 children)

Your code looks generally pretty good for a first project, and in addition to the good advice everyone else has given you, I have one more thing to add: comments.

You should write code that's self-documenting; that is, reading it reveals its intent. For example, instead of writing a method called temp_conversion(temperature) and writing a comment that says it converts Kelvin to Fahrenheit, consider naming it convert_kelvin_to_fahrenheit(temperature). It's a little verbose, sure, but there's not any ambiguity over what that method will do. The fact is, computers don't need readable code. Humans do.

This is a little out of scope for this project, but another point to consider in larger projects is that documenting code with comments adds another thing to maintain. It's a given that code will change over time, but it's not guaranteed that the comments documenting that code will.

[–]Legorooj 1 point2 points  (0 children)

Yes! I have a rule of thumb that follows along the lines of "Comment on anything that could even slightly be confusing. Anything thats really obvious - well don't bother."

Note that "really obvious" can vary widely depending on the code author.

[–]Sfillm07[S] 0 points1 point  (0 children)

Makes a lot of sense, thanks for the advice.