简体   繁体   English

如何为盲人程序员命名符号

[英]How to name symbols for blind programmers

How should I name the symbols I write in a way that they are read correctly by screen readers, so they do not create a barrier for blind programmers? 我应该如何命名我写的符号,以便屏幕阅读器正确读取它们,这样它们就不会为盲人程序员创造障碍? By "symbols" I mean things like variables and function names. “符号”是指变量和函数名称之类的东西。

For example, if I write a variable name as companyId , would it be read correctly? 例如,如果我将变量名称写为companyId ,是否可以正确读取? Or writing it as companyID would be better? 或者将其写为companyID会更好吗?

Opinionated answers between casing styles are not what I want. 套管样式之间的意见答案不是我想要的。 I just want a technical point of view if I should type HTTP over Http or Id over ID in order to help screen readers to spell it correctly. 我只想要一个技术观点,如果我应该在Http键入HTTP或在ID键入Id ,以帮助屏幕阅读器正确拼写它。

I am a blind programmer. 我是个盲人程序员。 Almost all screen readers do specialMixedCapsProcessing. 几乎所有的屏幕阅读器都进行了specialMixedCapsProcessing。 That is, every capital letter will be pronounced as a new word. 也就是说,每个大写字母都将作为一个新单词发音。

One challenge that I face regarding identifier naming is that it can be tricky to spot two similar-sounding variables, particularly if the only difference is towards the end (when tired, my brain does pattern-recognition!). 我在标识符命名方面面临的一个挑战是,发现两个相似的声音变量可能很棘手,特别是如果唯一的区别在于结束(当疲惫时,我的大脑会进行模式识别!)。 For example, numLinesInFile1/numLinesInFile2. 例如,numLinesInFile1 / numLinesInFile2。

A related observation is that the _ character is often spoken as "underline", which is 3 syllabuls. 一个相关的观察是_字符通常被称为“下划线”,这是3个音节。 This makes it less efficient IMHO to work with codebases where underlines_are_used. 这使得使用underlines_are_used的代码库的IMHO效率降低。 Some blind programmers rename "underline" to "line", but I find that confusing. 一些盲人程序员将“下划线”重命名为“line”,但我发现这令人困惑。

This is just one developer's opinion - other blind devs may have other ideas. 这只是一个开发者的意见 - 其他盲人开发者可能有其他想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM