3 ms·
It should be pointed out that with inlining, both versions are exactly the same at runtime. Descriptive function names never lie, comments often do.
by jeremiep 13y ago
It should be pointed out that with inlining, both versions are exactly the same at runtime.
Descriptive function names never lie, comments often do.
- masklinn 13y ago> Descriptive function names never lie Beg pardon[0]? function _utf8Encode(&$arr){ for($i=0;$i<(count($arr['parameters']));$i++){ $arr['parameters'][$i]= $arr['parameters'][$i]; } } function _utf8Decode(&$arr){ for($i=0;$i<count($arr['parameters']);$i++){ $arr['parameters'][$i]= $arr['parameters'][$i]; } } Or[1] public static string ReturnEmptyStringIfNullElseValue(string value) { if (value == null) { return ""; } else { return value.ToString().Trim(); } } [0] http://thedailywtf.com/Comments/There-and-Back-Again.aspx http://thedailywtf.com/Comments/There-and-Back-Again.aspx [1] http://thedailywtf.com/Articles/Common-Functions,-not-Common-Sense.aspx http://thedailywtf.com/Articles/Common-Functions,-not-Common...
- jeremiep 13y agoI stand corrected. Thank god I never have to deal with such code!
- wschroed 13y ago> Descriptive function names never lie, comments often do. Description function names lie just as much as comments. For example, I have run into cases in the wild where things like "get_item()" create database entries before returning a value. Yes, side effects are evil, etc etc, but the point is that at some point, somebody maintained the code and did not update every use of get_item() to now be get_and_or_create_items_if_it_is_sunday(). In rare cases, I have seen them at least update the local documentation.
- collyw 13y agoWhat's to say a function gets "fixed" without updating the name, in the same way that comments will not get updated? I see it would be less likely in a function, but not impossible.