-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add advanced lesson on naming [was: Do we want super long variable names in our lessons?] #44
Comments
In the era of tab-completion, I find the "too long" variable to be less relevant. As a reviewer (or maintainer or future me), I find descriptive variables far easier to understand. For example Great names are one of the best ways to reduce errors in code. |
In general, I avoid abbreviations. I suppose in the real world, I might write it more generically: |
fwiw i would name that "fahrenheit_to_kelvin" because "convert" is implied by the "to" construction. in practice what I would do is class Fahrenheit(float):
def to_kelvin(self) -> "Kelvin": ...
class Kelvin(float): ...
# and i would also probably alias a shorthand like
F = Fahrenheit but that's not great for intro lessons probably. edit: I find myself in naming conversations with other programmers like... extremely frequently. I'm not sure if we want to flag this once in lessons like "lots of people have lots of opinions about names, so there isn't one right way to do this, but just go with our names for now" so we can address it in a single spot and then not worry too much about it edit2: as far as what might be useful for a lesson, I think "use your context" is a super important and subtle lesson. So eg. I find myself needing to remind my lab members that in their project " I think that fits into the lesson theme of "expressive code" as a reminder that expression happens in multiple forms, naming is a big one, but package structure is also an expressive system (and a really important one!) edit3: actually i'm gonna split that off into a separate issue :) |
I've changed the title of this issue to reflect that someday the suggestions here could make their way into an advanced naming lesson. |
I like how expressive these names are. My only concern is they are so long! for the lessons we could do this but in my code I find really long names to make it harder to read too. @willingc do you have any thoughts on this? i love the use of a verb for the function
convert_fahr_to_kelv
might be a bit shorterOriginally posted by @lwasser in #37 (comment)
The text was updated successfully, but these errors were encountered: