5 ms·
We could probably resolve this aspect of the argument by teaching novices that a perfect/great/accurate/otherwise-superlative name(s) is better than almost any
by DannoHung 14y ago
We could probably resolve this aspect of the argument by teaching novices that a perfect/great/accurate/otherwise-superlative name(s) is better than almost any comment.
- le-manchester 14y agoNot at all because programming languages like Ruby parameter names don't tell the full story: if you have def find(name) what kind of type could be name? String "Steve"?? Symbol :Steve? Hash {:first => "Steve", :last => "Jobs"} ??
- aneisf 14y agoThat just means that 'name' is a poor name for the parameter. Have 'first_name, last_name' or 'full_name' or 'names,' for example. In addition, I think it's a good practice to get into to try and validate parameters at the top of any method. If the values don't fit your use for them, raise an exception.
- paul-woolcock 14y agoThat strikes me as very Pythonic attitude. If you're going to fail, fail early. But, I know Python way better than Ruby, so it might very well be a Ruby thing too.
- mgurlitz 14y agoWouldn't the Pythonic thing be to only fail after you've tried, instead of validating your parameters in advance?
- agentultra 14y agoYes. It's easier to beg for forgiveness than to look before you leap. You just use your parameters regardless of types and let the exceptions fly.
- DeepDuh 14y agoIs that really Pythonic? Isn't that just general best practice in programming?
- aneisf 14y agoI'm not sure if it's Pythonic as I've never written Python. It's a habit I carried over from the .NET world, actually.