[Engineering] A Guide to Naming Variables

Nick Wilson (Quiddity) nwilson at wikimedia.org
Mon May 16 22:14:35 UTC 2016


I added it to the Further Reading section in
https://www.mediawiki.org/wiki/Naming_things ;-)

On Mon, May 16, 2016 at 1:42 PM, Kevin Smith <ksmith at wikimedia.org> wrote:

> I agree with most of that article.
>
> In the section "Move Simple Comments Into Variable Names", I was surprised
> the author didn't mention the #1 reason to do so: It's too easy to forget
> to update a comment when the meaning of the variable changes. The later
> section "Use Longer OTVs to Explain Confusing Code" is another great
> example of clearer code reducing/eliminating the need a comment.
>
> I'm not sold on avoiding cliches like "count" and "result", if you're
> keeping idioms like "i" and "n".
>
> Sidebar anecdote: In my second-ever paid programming job, we were forced
> to use only letter+digit variable names, like A2 and G6, because our
> (interpreted) program had to fit in 32K of RAM, and longer variable names
> would have consumed precious space. It was an awesome early lesson on the
> power of meaningful variable names.
>
>
>
> Kevin Smith
> Agile Coach, Wikimedia Foundation
>
>
> On Tue, May 3, 2016 at 4:24 AM, Filippo Giunchedi <
> fgiunchedi at wikimedia.org> wrote:
>
>>
>> http://a-nickels-worth.blogspot.ie/2016/04/a-guide-to-naming-variables.html
>>
>> (full disclosure: from a former colleague)
>>
>> _______________________________________________
>> Engineering mailing list
>> Engineering at lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/engineering
>>
>>
>
> _______________________________________________
> Engineering mailing list
> Engineering at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/engineering
>
>


-- 
Nick Wilson (Quiddity)
Community Liaison
Wikimedia Foundation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.wikimedia.org/pipermail/engineering/attachments/20160516/206b0d08/attachment.html>


More information about the Engineering mailing list