On Tue, Jul 7, 2015 at 6:06 PM, Karl Tomlinson <mozn...@karlt.net> wrote:
> Jeff Gilbert writes: > > > I work with a number of these, but after a page or two, why is it at all > > relevant which vars were args? For information flow? Should we mark > locals > > that purely derive from args as `aFoo` as well? Long functions (which > have > > poor readability anyway) generally have so much going on that the trivia > of > > which vars are args does not seem very useful.. > > > > I do not see how `aFoo` helps here, so please expand on this. > > A simple variable name, such as "font" for example, may identify > any of a number of fonts. Such simple names, without any > qualifier in the name, are often used in loops, for example, > because it is the most important font in the immediate context. > > However a simple variable may also be used in a parameter list > because when looking at the parameter list it is obvious which > font is relevant in the interface. > > That means that if "font" is seen in the body of a function, the > first question that arises is "which font?" > If it's named well, there should be no question which it refers to, with or without argument decoration. > > If the variable is called "aFont" then we know which font because > we know what function we are in. > Use aFont if it helps, just as we use iFoo and fFoo sometimes when doing conversions. Don't require it though. In particular, `newSize` is better than `aSize` when also dealing with mSize. Inferring the meaning of a variable from its status as an argument is a crutch for poor variable naming. (and adds mental load) _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform