News for hackers. Stuff that matters.
Re:38% of bugs at Airbnb could have been prevented by using ... by Alex3917 on Sunday February 10, 2019 @09:57PM (#19131726)
> Most of the time, when I see a new function, I have no idea what’s the type of its parameters...

For that reason I usually use types for defining utility functions that get re-used in multiple places throughout the app. For everything else I just name the variables according to what the thing is, e.g.:

user_model, user_model_list, user_id_set, user_id_to_user_model_dict, etc. If you have a good style guide, there really should only be one allowable name for any given variable, and it should be immediately clear what type each variable is from the suffix on the name.

Re:38% of bugs at Airbnb could have been prevented by using ... by kaoD on Monday February 11, 2019 @04:21AM (#19133074)
Isn't that just ad-hoc typing?

What's the point of naming based on types, instead of just declaring types so they can be programmatically analyzed by your tools?

Re:38% of bugs at Airbnb could have been prevented by using ... by Alex3917 on Monday February 11, 2019 @12:38PM (#19136282)
> What's the point of naming based on types

More readable. When declaring a type you only see the type when the variable is declared or when it's passed into a function, whereas when putting the type in the name it's obvious in each line where it's used so you don't need to waste working memory on remembering what things are.

Re:38% of bugs at Airbnb could have been prevented by using ... by cstejerean on Sunday February 10, 2019 @10:44PM (#19131897)
Ah yes, the old Hungarian notation (or variation on that idea). Makes sense in some contexts.