<p>You didn't mention what programming language(s) you're working with, but the way <a href="https://en.wikipedia.org/wiki/PowerShell" rel="nofollow noreferrer">PowerShell</a> names things might be helpful here.</p>
<p>Functions have names like <a href="https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Management/Get-Process" rel="nofollow noreferrer"><code>Get-Process</code></a>, <a href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/clear-itemproperty" rel="nofollow noreferrer"><code>Clear-ItemProperty</code></a>, <a href="https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Management/Get-Process" rel="nofollow noreferrer"><code>Write-Host</code></a>, etc.  They're all of the form &quot;verb dash noun&quot;.  There's a predefined <a href="https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands" rel="nofollow noreferrer">list of verbs</a> that they encourage you to use whenever possible.  When naming function parameters, they have predefined <a href="https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/standard-cmdlet-parameter-names-and-types" rel="nofollow noreferrer">lists of common parameter names</a> along with their standard meaning.</p>
<p>PowerShell does this for the sake of consistency, but an approach like this could help a non-native speaker as well.  Those lists of words can be augmented with a description in their native language.  Naming something consists of selecting the relevant noun and verb from the list (substituting a native language word when needed).  Over time, the students will learn the vocabulary and not need the lists any more. Since they're using the same standard words as the built-in system functions, they're also learning how to interpret those functions without needing to look up and translate their documentation.</p>
<p>I'm not necessarily saying that you should teach them using PowerShell (that sounds quite awful, actually).  You can follow a similar idea and create a naming convention for whatever language you're using.  You'll have to build your own noun/verb lists, but you'll have the opportunity to fine-tune them based on your specific curriculum and assignments.</p>
<p>Standard library functions frequently have cryptic names, but you can create a helper header/library that provides wrappers around the relevant functions using the common naming convention. My CS teacher actually did that for us even though there wasn't a language issue. It helped focus on <em>concepts</em> instead of a specific language's library syntax, simplified many interfaces, and gave the instructor a place to inject helper code that made grading easier or that simulated errors.</p>
<p>You can strip back the layers in a more advanced course, after they're comfortable with the fundamentals.</p>

CC BY-SA 4.0
2023-06-01T02:11:29.363Z
Thanks for the information. I think I will try that. BTW, it also reminds me of my Objective-C days. Apple has some guidelines for naming  https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html
Qiulang 邱朗
CC BY-SA 4.0
2023-06-01T03:55:23.567Z
This [comment](https://cseducators.stackexchange.com/questions/7757/non-native-english-speakers-struggle-to-come-up-with-decent-variable-names-and-f#comment21210_7758) above is worth noting
Rushi
CC BY-SA 4.0
2023-06-01T18:34:34.787Z
(Many of the common PowerShell cmdlets [also have aliases](https://pvm-professionalengineering.blogspot.com/2019/10/powershell-aliases-and-missing.html), e.g., `ps` for [Get-Process](https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Management/Get-Process) (like on Linux/Unix))
Peter Mortensen
CC BY-SA 4.0
2023-05-31T16:55:08.977Z
2023-06-02T01:11:25.500Z
2023-06-02T01:11:25.500Z
bta
<h1>Some simple rules.</h1>
<ul>
<li>Design the code to be readable
<ul>
<li>Use the language of the domain: use the business language and natural language of the project. Most languages support unicode. e.g. <code>火出口</code> (it says fire exit in very bad Chinese: literally file exile mouth).</li>
<li>When naming things consider how they are used, over what they do: Consider what how they will look when used: e.g. <code>if cat.height &gt; 3*meters then direction.set(away from cat), run(fast)</code></li>
</ul>
</li>
</ul>
<p>To help with this:</p>
<ul>
<li>Actions should have verb-phrases for names. e.g. <code>run</code>, <code>stop</code>, <code>open</code>.</li>
<li>Booleans, and functions returning a boolean should have an adjective-phrase. e.g. <code>is running</code>, <code>is open</code>.</li>
<li>Non boolean objects, and functions returning such, should have noun-phrase names. e.g. <code>cat</code>, <code>door</code>, <code>big cat</code>.</li>
<li>Sometimes you will need enumerations to pass in to a procedure, these will often be adverbs. e.g. <code>quickly</code>.</li>
</ul>
<p>Most of this is general advice. However back to the non-English and English speaker. So if they can type their native language, then do that. I cannot think of a language that does not support Unicode names. E.g. these do support it: <code>C</code>, <code>python</code>, <code>rust</code>, <a href="https://scratch.mit.edu/" rel="nofollow noreferrer"><code>scratch</code></a>, …</p>

CC BY-SA 4.0
2023-06-01T18:32:16.863Z
2023-06-03T17:43:39.950Z
2023-06-03T17:43:39.950Z
ctrl-alt-delor
<p>As others say, good naming is hard even for native English speakers.</p>
<p>I don't think there is a straightforward curriculum to follow that makes one good at naming, or a simple criteria against which to measure success.</p>
<p>At the stage of learning programming, when there is still plenty to learn, it might not be important for chosen names to always be great names.</p>
<p>However, I would suggest having regular discussion about the importance of naming, and have examples of good naming schemes for pupils to consider and absorb.</p>
<p>A pre-requisite for naming in English is to be deeply familiar with English. Exposure to a large amount of vocabulary, and examples of existing software naming schemes are also useful.</p>
<p>To become skilled at naming, a person generally has to be interested in language, to some degree for its own sake.</p>
<p>Some others here have also said names don't matter too much in programming. That can be true in limited cases, but as a general statement nothing could be more preposterously false.</p>

CC BY-SA 4.0
2023-06-01T04:50:02.290Z
Good points! As to importance of naming: Naming is about *best-practice.* Beginning students have a hard time knowing that `else` goes with `if` not `while` (unless you're in Python!), that conditions must be parenthesized (C family) or terminated by ':' (Python).  Zillions of such minor points that experienced programmers have struggled understood internalized *and forgotten the struggle*.
Rushi
CC BY-SA 4.0
2023-06-01T04:50:12.717Z
In that context a foreign unfamiliar language is a heavy gratuitous burden. In short: naming is fundamental to *software engineering.* But theres a big gap noob-programming↠ SE. See my [pianist-analogy](https://cseducators.stackexchange.com/a/6164/8837)
Rushi
CC BY-SA 4.0
2023-06-01T08:14:45.170Z
@Rusi, the "while-else" is an exemplar of dreadful English naming! But yes, even with English itself, there is a process of schooling in which children learn alphabetic symbols and punctuation and all the rest of it. Meanwhile, vocabulary and word choice is largely learned from everyday listening and reading.
Steve
CC BY-SA 4.0
2023-05-31T10:47:00.317Z
2023-05-31T10:47:00.317Z
Steve
<p>The point of good variable/function/class naming is to express problem semantics to readers, including the programmers. If your readers are primarily French speakers, use good French naming for everything.</p>
<p>Unfortunately, most programming environments don't support Chinese and Japanese (or Navajo or ...) characters directly, or it would be proper to use those. But students should be encouraged to find names in their own language that correctly represent the intent of the program item and then, if the programming system won't directly support it and will only accept, say, Latin style alphabets, then a system like pinyin should be fine.</p>
<p>I'm assuming, however, that a reader, reading pinyin will associate the word(s) with the right concept and that the translation doesn't lose too much actual meaning.</p>
<p>Maybe the problem is yours if you aren't a native (-ish) Chinese speaker. But I shouldn't have to use French words unless I were writing for a French speaking audience.</p>
<hr />
<p>Caveat: If a language can be written with unicode characters then large subsets of Chinese and Japanese and some others can be directly used. Java is an example. IIRC, though, keyboard entry is complicated.</p>

CC BY-SA 4.0
2023-05-29T17:39:38.377Z
Contrary to the practiced opinion of native English-speaking programmers, English is _not_ the language of programming. Allow, even encourage, the students to use the pinyin-ised names for what things are, or do in the language of the programmer. It would do my heart much good to have all our "languages" localised as well. I'd love to see a yóuyú or zeon loop in some clean code.
Gypsy Spellweaver
CC BY-SA 4.0
2023-05-30T16:38:11.310Z
Speaking of French, that reminds me of a project ([Framadate](https://framadate.org/abc/en/)) that was abandoned. Much of the source code is written in French. That makes it almost impossible to find a maintainer now. (-- While looking at the homepage again, it seems they changed their licensing and are trying to find some funding for it to continue development)
Thomas Weller
CC BY-SA 4.0
2023-05-30T18:17:57.540Z
While I, as a German software developer who's been in the industry for 40 years, strongly disagree with using anything but English in "real" code, I think there is a difference between learners and professionals. Learning to find good variable/method names is much more important than learning to find English names, and switching from good Chinese to good English is much easier than switching from bad names to good names. Don't rate them on their English skills, only check if the name they come up with is a good description of what the thing is used for.
Guntram Blohm
CC BY-SA 4.0
2023-05-31T06:53:17.163Z
@GuntramBlohm In my company we deliberately use German names for variables and functions in our code. A precondition is that the code will only ever be read by German speakers but if that is satisfied this approach has the advantage that one can immediately distinguish which functions are internal to our code and which come from some external library or similar source.
quarague
CC BY-SA 4.0
2023-05-31T17:31:39.710Z
@quarague As my employer realizes quite painfully, predictions are difficult, especially when they concern the future ;-). If your code base lives longer than a handful of years, chances are it will be maintained by people who don't speak German at all but read English well enough to understand English code. Note that this may well happen on German soil (as if that had any relevance these days, but still). Your company is myopic.
Peter - Reinstate Monica
CC BY-SA 4.0
2023-05-31T18:33:04.360Z
Since this is the most upvoted answer its good you've added the caveat at end. A comprehensive conspective lineup of Unicode vars in languages is [here](https://rosettacode.org/wiki/Unicode_variable_names).  Right here [my answer](https://cseducators.stackexchange.com/a/7779/8837) gives examples of Python and C and a smattering of Haskell.
Rushi
CC BY-SA 4.0
2023-06-01T00:35:14.900Z
I was told twice quite strongly to write comments, variable names, function names in German, and each time I ended up translating everything into English.
gnasher729
CC BY-SA 4.0
2023-06-01T01:29:47.243Z
@gnasher729 That's just the nature of the risk and reward involved. Cater to your local language skills or get access to significantly larger pool of English resources.
Nelson
CC BY-SA 4.0
2023-06-01T03:54:16.210Z
@GuntramBlohm excellent distinction! I've referred to it in a couple of comments below/elsewhere. Ppl unable to get your point are not teachers, almost certainly not *experienced* teachers. When one has taught for decades (and are generally regarded as a good teacher) one knows willynilly how many students have fallen through the cracks because of sundry neglected reasons.
Rushi
CC BY-SA 4.0
2023-06-01T06:14:01.910Z
@Peter-ReinstateMonica Of course no one can make perfect predictions of the future and you have to balance the possible advantages and disadvantages of either approach. But precisely because of that calling a company myopic without knowing any context about what they do is unnecessarily harsh and I'm quite confident wrong in my specific case (there are legal reasons the code will only ever be used in a German context and knowing German is required to understand what the code is used for).
quarague
CC BY-SA 4.0
2023-06-01T08:52:15.850Z
@quarague Yes, it was harsh, but warranted based on the available information. Legal reasons the code will only ever not only be used in a "German context" but also by German speakers (which is not the same) are exceedingly rare. In that case the company may not be overly myopic (although the legal frame may shift to a European level in our lifetime, conceivably).
Peter - Reinstate Monica
CC BY-SA 4.0
2023-06-01T08:56:05.643Z
@quarague I'll give a contrasting example: A German company produces trains with German workers in Germany for DB following German regulations. They are audited by TÜV and Eisenbahnbundesamt. 20 or 30 years later they are producing trains for a world market following European regulations with an internationally distributed team, and parts of the code base and documentation are in German. Perhaps not such a big deal in the great scheme of things, but: The default should *always* be English unless legal requirements forbid it ;-).
Peter - Reinstate Monica
CC BY-SA 4.0
2023-06-01T21:39:55.943Z
I don't think that it's correct to say "Unfortunately, most programming environments don't support Chinese and Japanese (or Navajo or ...) characters directly", as right now almost all programming environments *do* allow identifiers in non-Latin Unicode alphabets, as modern compilers and editors support this even for older languages like C, C++, Perl, Prolog; and of course languages like  JavaScript, Python, Go, Java, Ruby, etc have supported that for ages or even from day 1. So if you choose (for whatever reason) to use non-Latin identifiers, the tools will allow you to do that.
Peteris
CC BY-SA 4.0
2023-06-01T23:57:51.353Z
I've written code with identifiers in Esperanto in PHP as well as Java 15 years ago. Worked fine back then. (Looks a bit strange, as all the standard library functions and keywords are in English.)
Paŭlo Ebermann
CC BY-SA 4.0
2023-05-29T15:45:36.653Z
2023-05-31T17:26:28.507Z
2023-05-31T17:26:28.507Z
Buffy
<p>Why not use Chinese directly?</p>
<p>Here's a Python 3 script with normal ASCII, Devanagari (Hindi) and Chinese. This is both in identifiers (variables, function names) and also in strings.</p>
<h2>Table</h2>
<p>Ive used google translate used to make this table since I know exactly zero Chinese!</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>English (ASCII)</th>
<th>Hindi</th>
<th>Chinese</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>fool</code></td>
<td>बेवकूफ</td>
<td>傻子</td>
</tr>
<tr>
<td><code>name</code></td>
<td>नाम</td>
<td>姓名</td>
</tr>
<tr>
<td><code>unknown</code></td>
<td>अजाना</td>
<td>未知</td>
</tr>
<tr>
<td><code>Hello</code></td>
<td>नमस्ते</td>
<td>你好</td>
</tr>
<tr>
<td><code>x</code></td>
<td>एक्स (transliteration)</td>
<td>x (as is)</td>
</tr>
</tbody>
</table>
</div><h2>Multilingual code</h2>
<p>Note the code below is rather poor on many counts! It's just a couple of lines to demo Python doing multilingual strings and identifiers.</p>
<pre class="lang-py prettyprint-override"><code># ASCII
def fool(unknown): #  fool is to make foo translatable!
                   #  normally I'd use x for unknown
    name = input()
    for x in range(4):
        print(&quot;Hello %s %d %s&quot; % (name, x, unknown))
        
# Devanagari
def बेवकूफ(अजाना):
    नाम = input()
    for एक्स in range(4): # literal transliteration of x
        print(&quot;नमस्ते %s %d %s&quot; % (नाम, एक्स, अजाना))


# Chinese
def 傻子(未知):
    姓名 = input()
    for x in range(4): # Ive no idea about transliteration!!
        print(&quot;你好 %s %d %s&quot; % (姓名, x, 未知))

</code></pre>
<p>Here's a session showing ASCII and Chinese usage</p>
<pre><code>&gt;&gt;&gt; fool(42)
rusi
Hello rusi 0 42
Hello rusi 1 42
Hello rusi 2 42
Hello rusi 3 42

&gt;&gt;&gt; 傻子(42)
习近平
你好 习近平 0 42
你好 习近平 1 42
你好 习近平 2 42
你好 习近平 3 42
</code></pre>
<hr />
<h3>Note 1</h3>
<p>There are reasons for having strong reservations for how unicode has been adopted (but not adapted!) into Python -- and for that matter most modern languages.</p>
<p>Here's a Python (3 only) program.<br />
Note: Its Python 3 only not 2 which will immediately give syntax error on the 2nd line!</p>
<pre class="lang-py prettyprint-override"><code>#! /usr/bin/env python3
A = 1
Α = 2
А = 3
# The 1 and 2 should be overwritten by the 3 right??
print(&quot;And now the miracle [A, A, A] is %s&quot; % [A, Α, А])
</code></pre>
<p>And a run:</p>
<pre class="lang-py prettyprint-override"><code>~:$ python3 unipython.py 
And now the miracle [A, A, A] is [1, 2, 3]
</code></pre>
<p>So Python has A being 1,2, and 3 <strong>at the same time</strong>?!?!</p>
<p>Strange aint it?</p>
<blockquote class="spoiler">
<p> Well they are not 3 A's but one Greek alpha, one Russian (Cyrillic) A and one good ol ASCII A!

Who'd have guessed?!</p>
</blockquote>
<h3>Note 2</h3>
<p>As pointed out in other answers and comments unicode identifiers is the norm not the exception nowadays.</p>
<p>Here's C (gcc). Seems to work well enough</p>
<pre><code>#include &lt;stdio.h&gt;
int foo(int x)
{ return x + 1;}

int फू(int अ)
{ return अ + 1;}

int main()
{
  printf(&quot;Hello %d\n&quot;, फू(42));
}
</code></pre>
<h2>Note 3</h2>
<p>As said above the norm nowadays is that languages support unicode source code.  However the nuances across languages is a veritable worm-can.</p>
<p>Eg in Python <code>ﬂag</code> and <code>flag</code> are the same.<br />
In Haskell they are different</p>
<h2>More Philosophical objections</h2>
<p>Ive shown above that Python (and many other languages) will allow <strong>user-defined variables/functions/classes</strong> to be from a vastly wider character set than ASCII.</p>
<p>What about builtin functions/types/classes?</p>
<p>Well you could introduce a 'translation-library' that maps Chinese versions of the 50 most used library entities into Chinese.</p>
<p>Laborious but doable</p>
<p>But then what about keywords — if,while,def,class...??
More laborious — recompile Python with all these keywords localized.</p>
<p>Does it stop here?  What will you do when your kids need to progress beyond your classes to reading the docs?</p>
<p>All of this is possible but as you go further afield from my toy examples above it quickly gets tedious and intractable.</p>
<p>OTOH none of these are rhetorical questions. With 1.4 billion population, China could dedicate a couple of thousand to heavy-lifting the localization effort.</p>
<p>So at a single individual level you need to think through where you draw your lines...</p>
<h2>Personal Note</h2>
<p>At a more personal level I strongly believe that <strong>beginning</strong> students should not be made to break their heads over large ugly real world languages like Python/C++/Java but learn to experience the richness of programming in a controlled baby nursery — which in your case would mean not burdening your kids with programming <em>and</em> a foreign language <em>simultaneously</em>.</p>
<h2>Full Languages List</h2>
<p>Apart from Python, C, Haskell that Ive talked of above what of the dozens of other languages?  Rosetta code has a <a href="https://rosettacode.org/wiki/Unicode_variable_names" rel="nofollow noreferrer">conspective list</a></p>
<h2>References</h2>
<p>Here are some Python 3 references that may be useful</p>
<ol>
<li><a href="https://docs.python.org/3.11/reference/lexical_analysis.html#identifiers" rel="nofollow noreferrer">Python identifiers lexical structure</a></li>
<li><a href="https://peps.python.org/pep-3131/" rel="nofollow noreferrer">The Python Design Document</a></li>
<li><a href="https://docs.python.org/3/howto/unicode.html" rel="nofollow noreferrer">General Python Unicode Howto</a></li>
<li><a href="https://mail.python.org/pipermail/python-3000/2007-May/007524.html" rel="nofollow noreferrer">The mailing list discussion</a> (started by a French-Japanese-English trilingual)</li>
<li><a href="https://unicodebook.readthedocs.io/unicode.html#categories" rel="nofollow noreferrer">Unicode letter categories</a> — not Python specific</li>
<li><a href="https://www.hieuthi.com/blog/2021/07/22/unicode-categories-cjk-ideographs.html" rel="nofollow noreferrer">Unicode categories and CJK ideograph complications</a></li>
<li><a href="http://blog.languager.org/search/label/Unicode" rel="nofollow noreferrer">My own thoughts on programming using unicode</a> — can be whimsical!</li>
</ol>

CC BY-SA 4.0
2023-05-31T10:22:37.633Z
The thought never occurred to me.  I need to do some research first
Qiulang 邱朗
CC BY-SA 4.0
2023-05-31T10:35:08.737Z
Ive added some links/references that you may find useful @Qiulang邱朗
Rushi
CC BY-SA 4.0
2023-06-01T09:44:44.903Z
Speaking of homoglyphs ("AΑА"), it is Unicode to be blamed that identical characters are duplicated with distinct codes.
Trang Oul
CC BY-SA 4.0
2023-06-01T11:32:01.130Z
@Qiulang邱朗 Are the characters in my answer 'Hanzi'? Since I've no idea what's hanzi, simplified, pinyin and what not I just left the vague 'Chinese'. If Hanzi is more accurate I'll change accordingly
Rushi
CC BY-SA 4.0
2023-06-01T11:35:44.753Z
@TrangOul *Unicode blamed for homoglyphs*. Lets grant that. What will you do? What do you do about war, disease and death? As the saying goes "Sun, moon and taxes" is fait accompli. Likewise unicode. OTOH I don't think blaming unicode makes sense. ASCII was made by techies *for techies*. Unicode was made by techies and linguists etc *for the world*. At **3-4 orders of magnitude gap** from ASCII to unicode, expecting the same (techie) attitude to work will not. Specifically, prog. languages should *opt out by default, opt in with explicit decl/pragma* — like html's charset declaration
Rushi
CC BY-SA 4.0
2023-06-01T11:48:17.987Z
@Rusi Sorry hanzi is the pinyin of the **Chinese Character**. And yes the characters in your answer are 'Hanzi'
Qiulang 邱朗
CC BY-SA 4.0
2023-06-01T18:06:38.737Z
[GCC allegedly only caught up in mid 2020](https://stackoverflow.com/questions/12692067/and-other-unicode-characters-in-identifiers-not-allowed-by-g/42158646#42158646) ([version 10](https://gcc.gnu.org/releases.html)). A lot of folks are still using [Turbo C++](https://www.quora.com/What-are-some-bitter-truths-about-engineering-in-India/answer/Adhokshaj-Mishra) (often forced to) or similar old versions (incl. GCC).
Peter Mortensen
CC BY-SA 4.0
2023-06-02T00:31:40.357Z
Tnx for the heads up @PeterMortensen. But I'm not sure what your point is. Some people are forced to learn programming without minimal English background, some with obsolete software.  Lots of ppl, lots of handicaps! Is there a case for "Lots of Turbo C++ in Chinese academia? After all Unicode is decades old,  but unicode  everywhere OS is still a developing subject... More pragmatically Still lot of Python 2 (and academically it's better)
Rushi
CC BY-SA 4.0
2023-06-02T06:48:51.250Z
@PeterMortensen   Also if some hapless 12 year old is being subjected to C(++) in 2023, theres a bigger problem right there as compared to whether the specific C version is Turbo C!
Rushi
CC BY-SA 4.0
2023-05-31T08:10:55.890Z
2023-05-31T19:22:41.950Z
2023-05-31T19:22:41.950Z
Rushi
<p>I'll be provocative: English is the <em>lingua franca</em> of computer science. Ideally, every CS professional should be able to understand basic English technical texts. At a minimum, a software engineer should be able to write and read programs with English variable names and basic comments.</p>
<p>I understand that the vocabulary of your students is limited; it is the job of the institution at which they learn to improve it to the minimum described above. If possible, the programming course should be accompanied by a 1-or 2-hours/week language course providing the specific vocabulary needed for the programming tasks. If that's not possible, fill the gap yourself. Simple English is incredibly simple, certainly from a Chinese perspective. Your students can already read the Latin alphabet. What's needed on top are a few dozen words, plus a few words of the respective problem domain for each programming task. Modern IDEs even have spell checkers.</p>
<p>I also understand that I may be narrow-minded and have it backwards: I may live to see Chinese programmers making the same claim with respect to Chinese. But we ain't there yet, so do your students a favor and require English names for variables and functions.</p>

CC BY-SA 4.0
2023-05-31T15:52:57.737Z
English is simple?!?! [See](https://twitter.com/tweetsauce/status/1132719589203169280). More seriously, I don't dispute that every programmer in the world of 2023 will be better off for better english.  I dispute that it needs to be an added burden to 10-12 yearolds
Rushi
CC BY-SA 4.0
2023-05-31T16:00:34.337Z
@Rusi 10-12 yearolds, no. University students using their native language when working with established codebase (written by me, not an English native) that uses only English - absolutely. (true story)
Vladimir F Героям слава
CC BY-SA 4.0
2023-05-31T16:01:49.470Z
@VladimirFГероямслава don't get (parse!) your second sentence.  Absolutely what?
Rushi
CC BY-SA 4.0
2023-05-31T16:27:10.363Z
@Rusi Middle school ranges from 10 to 16, I think. True, it would be wanted much for 10 year olds, but perhaps not for 14 or 15 year olds (they would really profit from a few words of English, not only in CS).
Peter - Reinstate Monica
CC BY-SA 4.0
2023-05-31T16:29:16.160Z
@Rusi As to your humorous Twitter link: None of the words are needed for programming (unless they appear in the subject domain), and pronunciation (the topic of the post, and problem for many learners) is irrelevant in any case.
Peter - Reinstate Monica
CC BY-SA 4.0
2023-05-31T17:26:40.040Z
This German speakers [comment](https://cseducators.stackexchange.com/questions/7757/non-native-speakers-struggle-to-come-up-with-decent-variable-names-and-function#comment21210_7758) says it all succinctly
Rushi
CC BY-SA 4.0
2023-06-01T15:50:53.223Z
_"Simple English is incredibly simple, certainly from a Chinese perspective"_, not really. If you grew up learning both, then probably. But not if you're a Chinese student, the two just isn't comparable.
Passer By
CC BY-SA 4.0
2023-06-02T00:29:41.710Z
If your students [can't] already read the Latin alphabet, then they're SoL. +1. I'm assuming this isn't really a problem with French or Germans, but if your alphabet is in Cyrillic or straight up pictures that don't load for me because I'm missing a font, then that's going to be a problem. *People with low command of the language unable to name things?* Correct.
Mazura
CC BY-SA 4.0
2023-05-31T15:09:19.007Z
2023-05-31T15:09:19.007Z
Peter - Reinstate Monica
<p>Not an educator but a CS student, reading your description of the challenges your students face when it comes to naming variables and functions resonated with me. As a non-native English speaker myself, I have experienced similar situations as a student.</p>
<p>I am originally from Slovenia and moved to Seattle to pursue a major in Computer Science. English not being my first language, I initially struggled with expressing my thoughts effectively in programming. However, one of my professors shared a valuable insight that I believe might apply to your students as well. They emphasized that as long as the code is <strong>logically sound</strong> and the <strong>purpose</strong> of variables and functions is <strong>clear</strong>, the exact choice of names becomes <strong>less crucial</strong>.</p>
<p>Given the limited vocabulary of your students, it may seem challenging to encourage them to use meaningful names. However, it is important to emphasize the logical clarity of their code rather than solely focusing on the names. Encourage them to use naming conventions that make sense within their context, such as pinyin in the case of Chinese students. While it may sound unusual, it serves its purpose of conveying meaning within their linguistic capabilities.</p>
<p>Furthermore, you can gradually introduce additional vocabulary to expand their options for naming. Incorporating activities that promote vocabulary development and discussing the importance of meaningful names can help them gradually improve their skills. Might be a shot in the dark but you could potentially introduce them to <a href="https://en.wikipedia.org/wiki/Metasyntactic_variable" rel="nofollow noreferrer">Metasyntactic variable names</a></p>
<p>One possible solution could be documenting code, nothing too fancy but just adding a comment above. Its purpose is to explain what it does. Note that programmers might go for a different style of documenting their code. I would suggest not &quot;dumping&quot; everything on them at once (speaking from experience I hated it at first, but now I see why it's important), but introduce them to a simple one-line comment. Later on, you can tell them to list <code>pre</code> and <code>post</code> conditions and even <code>invariants</code></p>
<p>Example:</p>
<pre><code>void swap(int *num_1, int *num_2)
{
    int temp = *num_1;
    *num_1 = *num_2;
    *num_2 = temp;
}
</code></pre>
<p>Now the code above is pretty much self-explanatory, it takes in two integer pointers and swaps them. It arguably needs no documentation.</p>
<p>Now let's look at this example:</p>
<pre><code>void ab(int* a, int* b)
{
    int c = *a;
    *a = *b;
    *b = c;
}
</code></pre>
<p>This is still somewhat self-explanatory but without prior <code>C++</code> or programming knowledge someone wouldn't know what's going on. To solve this problem we could simply do something like this:</p>
<pre><code>// {Zamenja 2 stevili} (Slovenian)
// {Translates to: Swaps 2 numbers}
void ab(int* a, int* b)
{
    int c = *a;
    *a = *b;
    *b = c;
}
</code></pre>
<p>Or something like this:</p>
<pre><code>// {
// desc: Zamenja 2 stevili (Slovenian)
// param: a -&gt; pointer na prvo stevilo
// param: b -&gt; pointer na drugo stevilo
//
// English translation:
//
// desc: Swaps 2 numbers
// param: a -&gt; pointer to the first integer
// param: b -&gt; pointer to the second integer
// }
void ab(int* a, int* b)
{
    int c = *a;
    *a = *b;
    *b = c;
}
</code></pre>
<p>Or if you want to be fancy and use <code>doxygen</code></p>
<pre><code>/**
 * @brief Zamenja 2 stevili (Slovenian)
 * @param a pointer to the first integer
 * @param b pointer to the second integer
 */
void ab(int* a, int* b)
{
    int c = *a;
    *a = *b;
    *b = c;
}

</code></pre>
<p>Now this results in some code that is a little more readable and someone else might have a better idea of what's going on.</p>
<p>On that note I would like to add that naming variables like <code>s</code> or <code>r</code> and so on is considered bad practice, this is the stuff they do in <code>code-golf</code> and <code>dynamic programming</code>, what I presented is only a shorthand solution and not a long term one.</p>
<p><strong>Edit:</strong> I'm assuming you all speak the same language and there is no language barrier.</p>
<p>Best of luck in your teaching career.</p>

CC BY-SA 4.0
2023-05-30T06:12:54.960Z
Thanks for sharing your story, as for you I would recommend using github copilot, one of its selling points is to [help non-native speakers](https://github.blog/2022-09-14-8-things-you-didnt-know-you-could-do-with-github-copilot/#1-assisting-non-native-english-speakers) to come up with good names. lol
Qiulang 邱朗
CC BY-SA 4.0
2023-05-30T06:55:13.510Z
I dislike Co-Pilot, yeah it's good in the industry (Software developers) and has many great applications, but it also violates academic integrity and basically does all the work for you, which means you don't learn anything...not to mention it also costs a decent amount. I appreciate the feedback tho
I_throw_but_dont_catch
CC BY-SA 4.0
2023-05-30T16:43:43.093Z
I don't see why you can write "swap" in the comment but not as the method name. You still use pointers instead of references? Please, dear student, learn modern C++, not C.
Thomas Weller
CC BY-SA 4.0
2023-05-30T18:25:35.503Z
Sorry, but I don't like this at all. What if you have 576 different functions, with names from `aa` to `zz` - how many of those names can you remember, and how often will you confuse them? (This reminds me of the old days when I wrote CATIA V4 macros, with a library of several  hundred function names, all of them some 6 character abbreviation because that's what the linker was restricted to). The name of a method should be clear enough so you can infer what it does when you read the calling line without having to resort to any documentation.
Guntram Blohm
CC BY-SA 4.0
2023-05-30T20:30:05.897Z
@GuntramBlohm I agree and I said "*short-term solution and not ideal*" and I am also assuming these kids are not writing some super complex programs with 600 functions defined all over the global namespace (Introducing namespace could also arguably be a +). I believe that with 10 functions, things like that are manageable.
I_throw_but_dont_catch
CC BY-SA 4.0
2023-05-30T20:34:47.837Z
@ThomasWeller Also --> I am assuming they would write "swap" in **Chinese/their own language**, **not English** since the question stated they lack **English** vocabulary.
I_throw_but_dont_catch
CC BY-SA 4.0
2023-05-31T13:45:53.407Z
The point about short variable names is overrated to some extent. Code should be readable, and if it is, then the choice of variable name matters far less. Using `i` as a loop index is perfectly fine for example, and I would similarly not consider your `a`/`b`/`c` example to be poorly written _provided the function has a descriptive name_ and is documented properly (because it’s so short and simple, there is little to no mental overhead in tracking the variables in that context).
Austin Hemmelgarn
CC BY-SA 4.0
2023-05-31T15:41:23.770Z
@ThomasWeller Despite some similarity in their names, C++ is not the up-to-date C or even a newer version of C. C is a perfectly good language in its own right.
Rosie F
CC BY-SA 4.0
2023-05-31T21:04:48.833Z
@RosieF: sure, I know. The term C++ is used in the answer. I just cited it and compared that declaration to the code associated with that label.
Thomas Weller
CC BY-SA 4.0
2023-05-30T05:09:32.230Z
2023-05-31T00:32:41.940Z
2023-05-31T00:32:41.940Z
I_throw_but_dont_catch
<p>Native English-speaking computer science students also have trouble coming up with good names!</p>
<p>In my opinion using <em>pinyin</em> is fine. In some ways it will be helpful for new students as they will get a clue of what their code is and what language keywords and 'Base Class Library' functions, etc. are.</p>
<p>You could look and see if there is another programming language, you could use, which supports Unicode characters in variable names.</p>
<p>I know this is possible in C#. See <em><a href="https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/identifier-names" rel="nofollow noreferrer">C# identifier naming rules and conventions</a></em></p>
<p>Sometimes you may need to start a variable with a Latin printable character for the first 'letter'. Something like an underscore.</p>

CC BY-SA 4.0
2023-05-31T02:11:41.473Z
2023-06-01T23:58:24.133Z
2023-06-01T23:58:24.133Z
Darcy Thomas
<p>Names should be descriptive for the audience of the source code. If everyone who looks at that code understands Chinese, there is nothing wrong with using Chinese names, and if you use a programming language that struggles with Chinese characters (do such languages still exist?), you can always transliterate to latin characters.</p>
<p>Alternatively, they can use English. In the age of machine translation, translating a term doesn't take much time. Even before machine translation, online dictionaries were a thing. Open the website, type your word, press Enter, and behold a set of translations to choose from :-)</p>
<p>It can also make sense to mix these approaches. In many programs I have written, I used English for IT concepts, and German for business concepts (the requirements document was in German, but the software libraries we used were in English). It may look weird to mix languages, but it worked very well. After all, the purpose of naming is to clearly convey information, not dazzle the audience with your mastery of the literary arts.</p>
<p>(What one shouldn't do in professional code is mix languages arbitrarily, switching seemingly at random. The same thing should have the same name throughout the entire source code)</p>

CC BY-SA 4.0
2023-05-31T01:27:27.130Z
2023-05-31T01:34:02.083Z
2023-05-31T01:34:02.083Z
meriton
<p>In my experience, it is in general hugely unreasonable to expect non-native middle schoolers to have any decent vocabulary of English. Granted, the English used in programming is not English in its entirety but it is still a lot to learn. Pinyin works fine for now, let them be.</p>
<p>To put things in perspective, non-native middle schoolers may be tested on 1000~2000 English words. Obviously not everyone will know all of them, and even less of them well. Even if English used in programming is very limited, there might still be a few hundred words that is commonly used. Asking the students to know them well is too much.</p>
<p>But make no mistake, English is the <em>de facto</em> standard language, and it should be made clear to them they should learn some English if they want to pursue programming further. The reasons why are innumerable</p>
<h3>Official documentation, books and tutorials</h3>
<p>Not knowing the vocabulary will limit the resources available to you. It is simply a fact that English resources are currently the best.</p>
<h3>Googling and Stack Exchange</h3>
<p>The fact that you're asking <em>here</em>, instead of say zhihu, is proof that knowing English is a great advantage. If you google in English, you get Stack Overflow. You'd be surprised how many people googled the wrong keywords, found nothing and gave up.</p>
<h3>Standard libraries and builtins</h3>
<p>These are not changeable and all of them relies on English. For example, in C++ it is <em>required</em> that your member functions are <code>begin</code> and <code>end</code> to enable range based for loops.</p>
<h3>Tooling</h3>
<p>There are tooling that relies on how English works. For example, pytest uses <code>test_*</code> and <code>Test*</code> as a signature that the objects are items for testing purposes.</p>
<p>The list goes on. As you might imagine, software <em>really</em> <strong>really</strong> cares about consistency.</p>
<p>Using Unicode characters is even worse for tooling:</p>
<ul>
<li>Regex support for non-ascii characters is usually poor to non-existent.</li>
<li>Go (the language) uses uppercase letters to indicate exported names.</li>
<li>The way whitespace plays with different languages is hugely variable.</li>
<li>Languages going from right to left is likely impossible to work with for many tools.</li>
</ul>

CC BY-SA 4.0
2023-06-01T18:34:13.453Z
Sometimes I wonder why everything is in English. Then I realise, the non English stuff does not come up in by searches.
ctrl-alt-delor
CC BY-SA 4.0
2023-06-02T01:32:18.293Z
The only thing I can add is to these words "The fact that you're asking here, instead of say zhihu..." I asked here instead of zhihu or quora is because I am an active user of SE and I think it is the best, say far better than quora, although I hate close-vote and down-votes without any comments.
Qiulang 邱朗
CC BY-SA 4.0
2023-06-01T15:46:37.493Z
2023-06-01T19:21:25.193Z
2023-06-01T19:21:25.193Z
Passer By
<p>The students I teach at a middle school in Beijing normally have a limited vocabulary. They struggle to come up with decent variable names and function names. Most of the time they just name variables as a, b, and c, and function names as ab, ac, and ad. Considering their vocabulary, telling them to use a meaningful name seems pointless.</p>
<p>Sometimes kids will use <a href="https://www.twinkl.com.tw/teaching-wiki/pinyin" rel="nofollow noreferrer">pinyin</a>,  a system to spell Chinese Characters with the Latin alphabet based on their pronunciation, to name the function, e.g. <code>fabs</code> in Chinese pinyin is &quot;jueduizhi&quot;, so instead of <code>fabs(x)</code> they call it <code>jueduizhi(x)</code>. That seems to be a workable solution although it looks strange at first.</p>
<p>I am a non-native English speaker myself but I have forgotten how I got through this obstacle. But I know naming may be hard for native English speakers too, otherwise, there wouldn't be the <a href="https://martinfowler.com/bliki/TwoHardThings.html" rel="nofollow noreferrer">two hard things</a> joke. The answer given by <a href="https://cseducators.stackexchange.com/a/7784/9884">@bta</a> gives me valuable input and also reminds me of my Objective-C days that Apple has some <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html" rel="nofollow noreferrer">guidelines for naming</a>, e.g. &quot;<em>The use of 'get' is unnecessary, unless one or more values are returned <strong>indirectly</strong>.</em>&quot; But that is another topic.</p>
<p>Does anyone have a similar situation to mine (not necessarily Chinese)? Any suggestion on how I teach these students to name their variables and functions better? Or does it not matter at this stage (when they try to learn the basic programming concepts)?</p>
<p>P.S. I would like to add this article as an anecdote to my question: <a href="https://thoughtbot.com/blog/learning-japanese-the-rubyist-way" rel="nofollow noreferrer">Learning Japanese the Rubyist way</a>. And it would be interesting if I can get someone from Japan to answer this question.</p>

CC BY-SA 4.0
2023-05-29T15:11:24.037Z
What is wrong with pinyin? The names make sense to them if they are descriptive of the semantics of the program. English speakers don't need to be mollified.
Buffy
CC BY-SA 4.0
2023-05-29T15:23:44.017Z
A, for starters, just some smart kids come up with this idea and I am not sure if it Is worth promoting the idea. B, it is not easy to use pinyin to name them in a consistent way, e.g. loop can have several translations in Chinese, then each with a different pinyin. C, some function/variable names we have gotten used to like worker/manager/factory, when translate to Chinese really sound strange in code. In a word I am not sure if it is a good idea.
Qiulang 邱朗
CC BY-SA 4.0
2023-05-30T09:25:25.793Z
I switched from my native Danish to English in my code many years ago, because (1) when you look up solutions they will often be in English; (2) standard designs (patterns) come with a well-defined English vocabulary; (3) libraries are all in English, mixed with other languages the code becomes hideous. Solution: Use ChatGPT or similar. E.g. ask it "What is a common term for a worker in a bank".
Niels Holst
CC BY-SA 4.0
2023-05-31T02:34:38.960Z
@Buffy: Coming from a non-English-speaking culture myself, there is generally a hard push for English to be used in code. Exceptions exist but they are exceedingly rare. Code written in my native language is often lower in quality - but this is a correlation, not a causation, i.e. people who avoid writing English are generally less confident with the language and therefore tend to not rely on English resource materials as much, which dramatically impacts their learning. [..]
Flater
CC BY-SA 4.0
2023-05-31T02:35:42.847Z
@Buffy: [..] A general drive for English in code as a matter of making developers confident in the language that pretty much all online resources are written in, is in my opinion a good push. Maybe not for the technical validity of the code itself but it keeps the technical language closer to the online source material, which is an argument not too dissimilar from the benefits of ubiquitous language.
Flater
CC BY-SA 4.0
2023-05-31T04:10:27.313Z
@Flater I agree with what you said but my question is about middle/high school kids, and does the naming matter at this stage when I try to teach them how to program(which I don't know)?
Qiulang 邱朗
CC BY-SA 4.0
2023-05-31T04:14:21.187Z
@Qiulang邱朗: It depends. If you are investing in their long term ability to learn how to develop software, then teaching them to get familiar with the lingua franca of the software development world is going to make it significantly easier for them to access learning resources. If this is an introductory class for students who have not yet committed to wanting to learn software development, then needing to get familiar with English is an unnecessary hurdle to understanding a very basic introductory principle of software development. The context of your curriculum matters.
Flater
CC BY-SA 4.0
2023-05-31T15:51:36.873Z
Consider that you also have comments.  So some additional options develop: pinyin identifiers with English comments, English identifiers with pinyin comments, English identifiers with full Unicode in comments
Ben Voigt
CC BY-SA 4.0
2023-05-31T22:40:09.760Z
Tell your students not to be so lazy! They should call it juéduìzhí, not jueduizhi. So everybody can understand it.
TonyK
CC BY-SA 4.0
2023-06-01T01:27:03.587Z
@TonyK I've never seen accented pinyin even in government documents.
Nelson
CC BY-SA 4.0
2023-06-01T02:03:23.290Z
@TonyK I can't tell if you were joking, but we seldom add tone to our pinyin. Most of the Chinese input methods can give you character/word candidates based on pinyin without tone.
Qiulang 邱朗
CC BY-SA 4.0
2023-06-01T05:55:54.313Z
The usual informal way I see of writing accented pinyin is with numbers to indicate the tones (eg. hao3) but I've never seen any kind of official accented pinyin on street signs etc. It would be cool if the students could just write the program with hanzi comments and variable names and pipe it through a filter that strips or translates in an appropriate manner the unicode characters before feeding it to the compiler, if that's what is required.
Spehro 'speff' Pefhany
CC BY-SA 4.0
2023-06-01T06:20:34.910Z
@SpehroPefhany I would rather them write hanzi comments but still use English names for variables and functions.
Qiulang 邱朗
CC BY-SA 4.0
2023-06-01T12:43:57.903Z
What is `fabs`?
Toivo Säwén
CC BY-SA 4.0
2023-06-01T13:38:28.243Z
@ToivoSäwén: Fabricated Stuff. More seriously, Floating Abs. Mathematical abs...
user21820
CC BY-SA 4.0
2023-06-01T13:56:04.460Z
Native speakers struggle as well ;)
Macario
CC BY-SA 4.0
2023-06-01T13:57:22.597Z
I think there is a difference between English proficiency and knowing specific mathematical abbreviations. It's offtopic to the question but why not use `floating_absolute`?
Toivo Säwén
CC BY-SA 4.0
2023-06-01T14:52:25.997Z
@ToivoSäwén It's a standard C function recognized in great many places. Changing its name does more harm then good, which ties in nicely to the point about using English to be consistent if not anything else.
Passer By
CC BY-SA 4.0
2023-06-02T00:35:10.407Z
Lesson ideas? No. *entrance exam*. Or passing grade in English 102.
Mazura
CC BY-SA 4.0
2023-06-02T03:13:00.147Z
@Mazura thanks for noticing that. Actually when I chose the tags for my question I found that none of the existing ones were close.
Qiulang 邱朗
CC BY-SA 4.0
2023-06-02T16:20:18.070Z
@PasserBy if it's a standard function, why would they reimplement it or redefine it as `jueduizhi(x)`? I think the answers to the question will differ if you are considering standard functions in the language or implementing new functions.
Toivo Säwén
CC BY-SA 4.0
2023-06-03T03:47:47.897Z
@ToivoSäwén because I just give them the very basic idea of programming, what is a function, you give it some input and then you get your output.
Qiulang 邱朗
<lesson-ideas><secondary-education>
Non-native English speakers struggle to come up with decent variable names and function names
# Non-native English speakers struggle to come up with decent variable names and function names

(Asked by: username_0 on 2023-05-29)

The students I teach at a middle school in Beijing normally have a limited vocabulary. They struggle to come up with decent variable names and function names. Most of the time they just name variables as a, b, and c, and function names as ab, ac, and ad. Considering their vocabulary, telling them to use a meaningful name seems pointless.

Sometimes kids will use [pinyin](https://www.twinkl.com.tw/teaching-wiki/pinyin), a system to spell Chinese Characters with the Latin alphabet based on their pronunciation, to name the function, e.g. `fabs` in Chinese pinyin is "jueduizhi", so instead of `fabs(x)` they call it `jueduizhi(x)`. That seems to be a workable solution although it looks strange at first.

I am a non-native English speaker myself but I have forgotten how I got through this obstacle. But I know naming may be hard for native English speakers too, otherwise, there wouldn't be the [two hard things](https://martinfowler.com/bliki/TwoHardThings.html) joke. The answer given by [@username_13](https://cseducators.stackexchange.com/a/7784/9884) gives me valuable input and also reminds me of my Objective-C days that Apple has some [guidelines for naming](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html), e.g. "*The use of 'get' is unnecessary, unless one or more values are returned **indirectly**.*" But that is another topic.

Does anyone have a similar situation to mine (not necessarily Chinese)? Any suggestion on how I teach these students to name their variables and functions better? Or does it not matter at this stage (when they try to learn the basic programming concepts)?

P.S. I would like to add this article as an anecdote to my question: [Learning Japanese the Rubyist way](https://thoughtbot.com/blog/learning-japanese-the-rubyist-way). And it would be interesting if I can get someone from Japan to answer this question.

**Tags:** lesson-ideas, secondary-education

> **Comments:**
> **username_1**: What is wrong with pinyin? The names make sense to them if they are descriptive of the semantics of the program. English speakers don't need to be mollified.  
> **username_0**: A, for starters, just some smart kids come up with this idea and I am not sure if it Is worth promoting the idea. B, it is not easy to use pinyin to name them in a consistent way, e.g. loop can have several translations in Chinese, then each with a different pinyin. C, some function/variable names we have gotten used to like worker/manager/factory, when translate to Chinese really sound strange in code. In a word I am not sure if it is a good idea.  
> **username_2**: I switched from my native Danish to English in my code many years ago, because (1) when you look up solutions they will often be in English; (2) standard designs (patterns) come with a well-defined English vocabulary; (3) libraries are all in English, mixed with other languages the code becomes hideous. Solution: Use ChatGPT or similar. E.g. ask it "What is a common term for a worker in a bank".  
> **username_3**: @username_1: Coming from a non-English-speaking culture myself, there is generally a hard push for English to be used in code. Exceptions exist but they are exceedingly rare. Code written in my native language is often lower in quality - but this is a correlation, not a causation, i.e. people who avoid writing English are generally less confident with the language and therefore tend to not rely on English resource materials as much, which dramatically impacts their learning. [..]  
> **username_3**: @username_1: [..] A general drive for English in code as a matter of making developers confident in the language that pretty much all online resources are written in, is in my opinion a good push. Maybe not for the technical validity of the code itself but it keeps the technical language closer to the online source material, which is an argument not too dissimilar from the benefits of ubiquitous language.  
> **username_0**: @username_3 I agree with what you said but my question is about middle/high school kids, and does the naming matter at this stage when I try to teach them how to program(which I don't know)?  
> **username_3**: @Qiulang邱朗: It depends. If you are investing in their long term ability to learn how to develop software, then teaching them to get familiar with the lingua franca of the software development world is going to make it significantly easier for them to access learning resources. If this is an introductory class for students who have not yet committed to wanting to learn software development, then needing to get familiar with English is an unnecessary hurdle to understanding a very basic introductory principle of software development. The context of your curriculum matters.  
> **username_4**: Consider that you also have comments.  So some additional options develop: pinyin identifiers with English comments, English identifiers with pinyin comments, English identifiers with full Unicode in comments  
> **username_5**: Tell your students not to be so lazy! They should call it juéduìzhí, not jueduizhi. So everybody can understand it.  
> **username_6**: @username_5 I've never seen accented pinyin even in government documents.  
> **username_0**: @username_5 I can't tell if you were joking, but we seldom add tone to our pinyin. Most of the Chinese input methods can give you character/word candidates based on pinyin without tone.  
> **username_7**: The usual informal way I see of writing accented pinyin is with numbers to indicate the tones (eg. hao3) but I've never seen any kind of official accented pinyin on street signs etc. It would be cool if the students could just write the program with hanzi comments and variable names and pipe it through a filter that strips or translates in an appropriate manner the unicode characters before feeding it to the compiler, if that's what is required.  
> **username_0**: @SpehroPefhany I would rather them write hanzi comments but still use English names for variables and functions.  
> **username_8**: What is `fabs`?  
> **username_9**: @ToivoSäwén: Fabricated Stuff. More seriously, Floating Abs. Mathematical abs...  
> **username_10**: Native speakers struggle as well ;)  
> **username_8**: I think there is a difference between English proficiency and knowing specific mathematical abbreviations. It's offtopic to the question but why not use `floating_absolute`?  
> **username_11**: @ToivoSäwén It's a standard C function recognized in great many places. Changing its name does more harm then good, which ties in nicely to the point about using English to be consistent if not anything else.  
> **username_12**: Lesson ideas? No. *entrance exam*. Or passing grade in English 102.  
> **username_0**: @username_12 thanks for noticing that. Actually when I chose the tags for my question I found that none of the existing ones were close.  
> **username_8**: @PasserBy if it's a standard function, why would they reimplement it or redefine it as `jueduizhi(x)`? I think the answers to the question will differ if you are considering standard functions in the language or implementing new functions.  
> **username_0**: @ToivoSäwén because I just give them the very basic idea of programming, what is a function, you give it some input and then you get your output.  

---

## 10 answers

### Answer by username_1 on 2023-05-29. Score: 19

The point of good variable/function/class naming is to express problem semantics to readers, including the programmers. If your readers are primarily French speakers, use good French naming for everything.

Unfortunately, most programming environments don't support Chinese and Japanese (or Navajo or ...) characters directly, or it would be proper to use those. But students should be encouraged to find names in their own language that correctly represent the intent of the program item and then, if the programming system won't directly support it and will only accept, say, Latin style alphabets, then a system like pinyin should be fine.

I'm assuming, however, that a reader, reading pinyin will associate the word(s) with the right concept and that the translation doesn't lose too much actual meaning.

Maybe the problem is yours if you aren't a native (-ish) Chinese speaker. But I shouldn't have to use French words unless I were writing for a French speaking audience.

---

Caveat: If a language can be written with unicode characters then large subsets of Chinese and Japanese and some others can be directly used. Java is an example. IIRC, though, keyboard entry is complicated.

> **Comments:**
> **username_18**: Contrary to the practiced opinion of native English-speaking programmers, English is _not_ the language of programming. Allow, even encourage, the students to use the pinyin-ised names for what things are, or do in the language of the programmer. It would do my heart much good to have all our "languages" localised as well. I'd love to see a yóuyú or zeon loop in some clean code.  
> **username_19**: Speaking of French, that reminds me of a project ([Framadate](https://framadate.org/abc/en/)) that was abandoned. Much of the source code is written in French. That makes it almost impossible to find a maintainer now. (-- While looking at the homepage again, it seems they changed their licensing and are trying to find some funding for it to continue development)  
> **username_20**: While I, as a German software developer who's been in the industry for 40 years, strongly disagree with using anything but English in "real" code, I think there is a difference between learners and professionals. Learning to find good variable/method names is much more important than learning to find English names, and switching from good Chinese to good English is much easier than switching from bad names to good names. Don't rate them on their English skills, only check if the name they come up with is a good description of what the thing is used for.  
> **username_21**: @GuntramBlohm In my company we deliberately use German names for variables and functions in our code. A precondition is that the code will only ever be read by German speakers but if that is satisfied this approach has the advantage that one can immediately distinguish which functions are internal to our code and which come from some external library or similar source.  
> **username_22**: @username_21 As my employer realizes quite painfully, predictions are difficult, especially when they concern the future ;-). If your code base lives longer than a handful of years, chances are it will be maintained by people who don't speak German at all but read English well enough to understand English code. Note that this may well happen on German soil (as if that had any relevance these days, but still). Your company is myopic.  
> **username_14**: Since this is the most upvoted answer its good you've added the caveat at end. A comprehensive conspective lineup of Unicode vars in languages is [here](https://rosettacode.org/wiki/Unicode_variable_names).  Right here [my answer](https://cseducators.stackexchange.com/a/7779/8837) gives examples of Python and C and a smattering of Haskell.  
> **username_23**: I was told twice quite strongly to write comments, variable names, function names in German, and each time I ended up translating everything into English.  
> **username_6**: @username_23 That's just the nature of the risk and reward involved. Cater to your local language skills or get access to significantly larger pool of English resources.  
> **username_14**: @GuntramBlohm excellent distinction! I've referred to it in a couple of comments below/elsewhere. Ppl unable to get your point are not teachers, almost certainly not *experienced* teachers. When one has taught for decades (and are generally regarded as a good teacher) one knows willynilly how many students have fallen through the cracks because of sundry neglected reasons.  
> **username_21**: @Peter-ReinstateMonica Of course no one can make perfect predictions of the future and you have to balance the possible advantages and disadvantages of either approach. But precisely because of that calling a company myopic without knowing any context about what they do is unnecessarily harsh and I'm quite confident wrong in my specific case (there are legal reasons the code will only ever be used in a German context and knowing German is required to understand what the code is used for).  
> **username_22**: @username_21 Yes, it was harsh, but warranted based on the available information. Legal reasons the code will only ever not only be used in a "German context" but also by German speakers (which is not the same) are exceedingly rare. In that case the company may not be overly myopic (although the legal frame may shift to a European level in our lifetime, conceivably).  
> **username_22**: @username_21 I'll give a contrasting example: A German company produces trains with German workers in Germany for DB following German regulations. They are audited by TÜV and Eisenbahnbundesamt. 20 or 30 years later they are producing trains for a world market following European regulations with an internationally distributed team, and parts of the code base and documentation are in German. Perhaps not such a big deal in the great scheme of things, but: The default should *always* be English unless legal requirements forbid it ;-).  
> **username_24**: I don't think that it's correct to say "Unfortunately, most programming environments don't support Chinese and Japanese (or Navajo or ...) characters directly", as right now almost all programming environments *do* allow identifiers in non-Latin Unicode alphabets, as modern compilers and editors support this even for older languages like C, C++, Perl, Prolog; and of course languages like  JavaScript, Python, Go, Java, Ruby, etc have supported that for ages or even from day 1. So if you choose (for whatever reason) to use non-Latin identifiers, the tools will allow you to do that.  
> **username_25**: I've written code with identifiers in Esperanto in PHP as well as Java 15 years ago. Worked fine back then. (Looks a bit strange, as all the standard library functions and keywords are in English.)  

---

### Answer by username_28 on 2023-05-30. Score: 7

Not an educator but a CS student, reading your description of the challenges your students face when it comes to naming variables and functions resonated with me. As a non-native English speaker myself, I have experienced similar situations as a student.
I am originally from Slovenia and moved to Seattle to pursue a major in Computer Science. English not being my first language, I initially struggled with expressing my thoughts effectively in programming. However, one of my professors shared a valuable insight that I believe might apply to your students as well. They emphasized that as long as the code is logically sound and the purpose of variables and functions is clear, the exact choice of names becomes less crucial.
Given the limited vocabulary of your students, it may seem challenging to encourage them to use meaningful names. However, it is important to emphasize the logical clarity of their code rather than solely focusing on the names. Encourage them to use naming conventions that make sense within their context, such as pinyin in the case of Chinese students. While it may sound unusual, it serves its purpose of conveying meaning within their linguistic capabilities.
Furthermore, you can gradually introduce additional vocabulary to expand their options for naming. Incorporating activities that promote vocabulary development and discussing the importance of meaningful names can help them gradually improve their skills. Might be a shot in the dark but you could potentially introduce them to Metasyntactic variable names
One possible solution could be documenting code, nothing too fancy but just adding a comment above. Its purpose is to explain what it does. Note that programmers might go for a different style of documenting their code. I would suggest not "dumping" everything on them at once (speaking from experience I hated it at first, but now I see why it's important), but introduce them to a simple one-line comment. Later on, you can tell them to list pre and post conditions and even invariants
Example:
void swap(int *num_1, int *num_2)
{
    int temp = *num_1;
    *num_1 = *num_2;
    *num_2 = temp;
}

Now the code above is pretty much self-explanatory, it takes in two integer pointers and swaps them. It arguably needs no documentation.
Now let's look at this example:
void ab(int* a, int* b)
{
    int c = *a;
    *a = *b;
    *b = c;
}

This is still somewhat self-explanatory but without prior C++ or programming knowledge someone wouldn't know what's going on. To solve this problem we could simply do something like this:
// {Zamenja 2 stevili} (Slovenian)
// {Translates to: Swaps 2 numbers}
void ab(int* a, int* b)
{
    int c = *a;
    *a = *b;
    *b = c;
}

Or something like this:
// {
// desc: Zamenja 2 stevili (Slovenian)
// param: a -> pointer na prvo stevilo
// param: b -> pointer na drugo stevilo
//
// English translation:
//
// desc: Swaps 2 numbers
// param: a -> pointer to the first integer
// param: b -> pointer to the second integer
// }
void ab(int* a, int* b)
{
    int c = *a;
    *a = *b;
    *b = c;
}

Or if you want to be fancy and use doxygen
/**
 * @brief Zamenja 2 stevili (Slovenian)
 * @param a pointer to the first integer
 * @param b pointer to the second integer
 */
void ab(int* a, int* b)
{
    int c = *a;
    *a = *b;
    *b = c;
}


Now this results in some code that is a little more readable and someone else might have a better idea of what's going on.
On that note I would like to add that naming variables like s or r and so on is considered bad practice, this is the stuff they do in code-golf and dynamic programming, what I presented is only a shorthand solution and not a long term one.
Edit: I'm assuming you all speak the same language and there is no language barrier.
Best of luck in your teaching career.

> **Comments:**
> **username_0**: Thanks for sharing your story, as for you I would recommend using github copilot, one of its selling points is to [help non-native speakers](https://github.blog/2022-09-14-8-things-you-didnt-know-you-could-do-with-github-copilot/#1-assisting-non-native-english-speakers) to come up with good names. lol  
> **username_28**: I dislike Co-Pilot, yeah it's good in the industry (Software developers) and has many great applications, but it also violates academic integrity and basically does all the work for you, which means you don't learn anything...not to mention it also costs a decent amount. I appreciate the feedback tho  
> **username_19**: I don't see why you can write "swap" in the comment but not as the method name. You still use pointers instead of references? Please, dear student, learn modern C++, not C.  
> **username_20**: Sorry, but I don't like this at all. What if you have 576 different functions, with names from `aa` to `zz` - how many of those names can you remember, and how often will you confuse them? (This reminds me of the old days when I wrote CATIA V4 macros, with a library of several  hundred function names, all of them some 6 character abbreviation because that's what the linker was restricted to). The name of a method should be clear enough so you can infer what it does when you read the calling line without having to resort to any documentation.  
> **username_28**: @GuntramBlohm I agree and I said "*short-term solution and not ideal*" and I am also assuming these kids are not writing some super complex programs with 600 functions defined all over the global namespace (Introducing namespace could also arguably be a +). I believe that with 10 functions, things like that are manageable.  
> **username_28**: @ThomasWeller Also --> I am assuming they would write "swap" in **Chinese/their own language**, **not English** since the question stated they lack **English** vocabulary.  
> **username_29**: The point about short variable names is overrated to some extent. Code should be readable, and if it is, then the choice of variable name matters far less. Using `i` as a loop index is perfectly fine for example, and I would similarly not consider your `a`/`b`/`c` example to be poorly written _provided the function has a descriptive name_ and is documented properly (because it’s so short and simple, there is little to no mental overhead in tracking the variables in that context).  
> **username_30**: @ThomasWeller Despite some similarity in their names, C++ is not the up-to-date C or even a newer version of C. C is a perfectly good language in its own right.  
> **username_19**: @RosieF: sure, I know. The term C++ is used in the answer. I just cited it and compared that declaration to the code associated with that label.  

---

### Answer by username_14 on 2023-05-31. Score: 6

Why not use Chinese directly?
Here's a Python 3 script with normal ASCII, Devanagari (Hindi) and Chinese. This is both in identifiers (variables, function names) and also in strings.
Table
Ive used google translate used to make this table since I know exactly zero Chinese!




English (ASCII)
Hindi
Chinese




fool
बेवकूफ
傻子


name
नाम
姓名


unknown
अजाना
未知


Hello
नमस्ते
你好


x
एक्स (transliteration)
x (as is)



Multilingual code
Note the code below is rather poor on many counts! It's just a couple of lines to demo Python doing multilingual strings and identifiers.
# ASCII
def fool(unknown): #  fool is to make foo translatable!
                   #  normally I'd use x for unknown
    name = input()
    for x in range(4):
        print("Hello %s %d %s" % (name, x, unknown))
        
# Devanagari
def बेवकूफ(अजाना):
    नाम = input()
    for एक्स in range(4): # literal transliteration of x
        print("नमस्ते %s %d %s" % (नाम, एक्स, अजाना))


# Chinese
def 傻子(未知):
    姓名 = input()
    for x in range(4): # Ive no idea about transliteration!!
        print("你好 %s %d %s" % (姓名, x, 未知))


Here's a session showing ASCII and Chinese usage
>>> fool(42)
rusi
Hello rusi 0 42
Hello rusi 1 42
Hello rusi 2 42
Hello rusi 3 42

>>> 傻子(42)
习近平
你好 习近平 0 42
你好 习近平 1 42
你好 习近平 2 42
你好 习近平 3 42


Note 1
There are reasons for having strong reservations for how unicode has been adopted (but not adapted!) into Python -- and for that matter most modern languages.
Here's a Python (3 only) program.
Note: Its Python 3 only not 2 which will immediately give syntax error on the 2nd line!
#! /usr/bin/env python3
A = 1
Α = 2
А = 3
# The 1 and 2 should be overwritten by the 3 right??
print("And now the miracle [A, A, A] is %s" % [A, Α, А])

And a run:
~:$ python3 unipython.py 
And now the miracle [A, A, A] is [1, 2, 3]

So Python has A being 1,2, and 3 at the same time?!?!
Strange aint it?

 Well they are not 3 A's but one Greek alpha, one Russian (Cyrillic) A and one good ol ASCII A!

Who'd have guessed?!

Note 2
As pointed out in other answers and comments unicode identifiers is the norm not the exception nowadays.
Here's C (gcc). Seems to work well enough
#include 
int foo(int x)
{ return x + 1;}

int फू(int अ)
{ return अ + 1;}

int main()
{
  printf("Hello %d\n", फू(42));
}

Note 3
As said above the norm nowadays is that languages support unicode source code.  However the nuances across languages is a veritable worm-can.
Eg in Python ﬂag and flag are the same.
In Haskell they are different
More Philosophical objections
Ive shown above that Python (and many other languages) will allow user-defined variables/functions/classes to be from a vastly wider character set than ASCII.
What about builtin functions/types/classes?
Well you could introduce a 'translation-library' that maps Chinese versions of the 50 most used library entities into Chinese.
Laborious but doable
But then what about keywords — if,while,def,class...??
More laborious — recompile Python with all these keywords localized.
Does it stop here?  What will you do when your kids need to progress beyond your classes to reading the docs?
All of this is possible but as you go further afield from my toy examples above it quickly gets tedious and intractable.
OTOH none of these are rhetorical questions. With 1.4 billion population, China could dedicate a couple of thousand to heavy-lifting the localization effort.
So at a single individual level you need to think through where you draw your lines...
Personal Note
At a more personal level I strongly believe that beginning students should not be made to break their heads over large ugly real world languages like Python/C++/Java but learn to experience the richness of programming in a controlled baby nursery — which in your case would mean not burdening your kids with programming and a foreign language simultaneously.
Full Languages List
Apart from Python, C, Haskell that Ive talked of above what of the dozens of other languages?  Rosetta code has a conspective list
References
Here are some Python 3 references that may be useful

Python identifiers lexical structure
The Python Design Document
General Python Unicode Howto
The mailing list discussion (started by a French-Japanese-English trilingual)
Unicode letter categories — not Python specific
Unicode categories and CJK ideograph complications
My own thoughts on programming using unicode — can be whimsical!

> **Comments:**
> **username_0**: The thought never occurred to me.  I need to do some research first  
> **username_14**: Ive added some links/references that you may find useful @Qiulang邱朗  
> **username_26**: Speaking of homoglyphs ("AΑА"), it is Unicode to be blamed that identical characters are duplicated with distinct codes.  
> **username_14**: @Qiulang邱朗 Are the characters in my answer 'Hanzi'? Since I've no idea what's hanzi, simplified, pinyin and what not I just left the vague 'Chinese'. If Hanzi is more accurate I'll change accordingly  
> **username_14**: @TrangOul *Unicode blamed for homoglyphs*. Lets grant that. What will you do? What do you do about war, disease and death? As the saying goes "Sun, moon and taxes" is fait accompli. Likewise unicode. OTOH I don't think blaming unicode makes sense. ASCII was made by techies *for techies*. Unicode was made by techies and linguists etc *for the world*. At **3-4 orders of magnitude gap** from ASCII to unicode, expecting the same (techie) attitude to work will not. Specifically, prog. languages should *opt out by default, opt in with explicit decl/pragma* — like html's charset declaration  
> **username_0**: @Rusi Sorry hanzi is the pinyin of the **Chinese Character**. And yes the characters in your answer are 'Hanzi'  
> **username_15**: [GCC allegedly only caught up in mid 2020](https://stackoverflow.com/questions/12692067/and-other-unicode-characters-in-identifiers-not-allowed-by-g/42158646#42158646) ([version 10](https://gcc.gnu.org/releases.html)). A lot of folks are still using [Turbo C++](https://www.quora.com/What-are-some-bitter-truths-about-engineering-in-India/answer/Adhokshaj-Mishra) (often forced to) or similar old versions (incl. GCC).  
> **username_14**: Tnx for the heads up @PeterMortensen. But I'm not sure what your point is. Some people are forced to learn programming without minimal English background, some with obsolete software.  Lots of ppl, lots of handicaps! Is there a case for "Lots of Turbo C++ in Chinese academia? After all Unicode is decades old,  but unicode  everywhere OS is still a developing subject... More pragmatically Still lot of Python 2 (and academically it's better)  
> **username_14**: @PeterMortensen   Also if some hapless 12 year old is being subjected to C(++) in 2023, theres a bigger problem right there as compared to whether the specific C version is Turbo C!  

---

### Answer by username_22 on 2023-05-31. Score: 5

I'll be provocative: English is the *lingua franca* of computer science. Ideally, every CS professional should be able to understand basic English technical texts. At a minimum, a software engineer should be able to write and read programs with English variable names and basic comments.

I understand that the vocabulary of your students is limited; it is the job of the institution at which they learn to improve it to the minimum described above. If possible, the programming course should be accompanied by a 1-or 2-hours/week language course providing the specific vocabulary needed for the programming tasks. If that's not possible, fill the gap yourself. Simple English is incredibly simple, certainly from a Chinese perspective. Your students can already read the Latin alphabet. What's needed on top are a few dozen words, plus a few words of the respective problem domain for each programming task. Modern IDEs even have spell checkers.

I also understand that I may be narrow-minded and have it backwards: I may live to see Chinese programmers making the same claim with respect to Chinese. But we ain't there yet, so do your students a favor and require English names for variables and functions.

> **Comments:**
> **username_14**: English is simple?!?! [See](https://twitter.com/tweetsauce/status/1132719589203169280). More seriously, I don't dispute that every programmer in the world of 2023 will be better off for better english.  I dispute that it needs to be an added burden to 10-12 yearolds  
> **username_27**: @Rusi 10-12 yearolds, no. University students using their native language when working with established codebase (written by me, not an English native) that uses only English - absolutely. (true story)  
> **username_14**: @VladimirFГероямслава don't get (parse!) your second sentence.  Absolutely what?  
> **username_22**: @Rusi Middle school ranges from 10 to 16, I think. True, it would be wanted much for 10 year olds, but perhaps not for 14 or 15 year olds (they would really profit from a few words of English, not only in CS).  
> **username_22**: @Rusi As to your humorous Twitter link: None of the words are needed for programming (unless they appear in the subject domain), and pronunciation (the topic of the post, and problem for many learners) is irrelevant in any case.  
> **username_14**: This German speakers [comment](https://cseducators.stackexchange.com/questions/7757/non-native-speakers-struggle-to-come-up-with-decent-variable-names-and-function#comment21210_7758) says it all succinctly  
> **username_11**: _"Simple English is incredibly simple, certainly from a Chinese perspective"_, not really. If you grew up learning both, then probably. But not if you're a Chinese student, the two just isn't comparable.  
> **username_12**: If your students [can't] already read the Latin alphabet, then they're SoL. +1. I'm assuming this isn't really a problem with French or Germans, but if your alphabet is in Cyrillic or straight up pictures that don't load for me because I'm missing a font, then that's going to be a problem. *People with low command of the language unable to name things?* Correct.  

---

### Answer by username_31 on 2023-05-31. Score: 3

Native English-speaking computer science students also have trouble coming up with good names!

In my opinion using *pinyin* is fine. In some ways it will be helpful for new students as they will get a clue of what their code is and what language keywords and 'Base Class Library' functions, etc. are.

You could look and see if there is another programming language, you could use, which supports Unicode characters in variable names.

I know this is possible in C#. See *[C# identifier naming rules and conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/identifier-names)*

Sometimes you may need to start a variable with a Latin printable character for the first 'letter'. Something like an underscore.


---

### Answer by username_32 on 2023-05-31. Score: 3

Names should be descriptive for the audience of the source code. If everyone who looks at that code understands Chinese, there is nothing wrong with using Chinese names, and if you use a programming language that struggles with Chinese characters (do such languages still exist?), you can always transliterate to latin characters.

Alternatively, they can use English. In the age of machine translation, translating a term doesn't take much time. Even before machine translation, online dictionaries were a thing. Open the website, type your word, press Enter, and behold a set of translations to choose from :-)

It can also make sense to mix these approaches. In many programs I have written, I used English for IT concepts, and German for business concepts (the requirements document was in German, but the software libraries we used were in English). It may look weird to mix languages, but it worked very well. After all, the purpose of naming is to clearly convey information, not dazzle the audience with your mastery of the literary arts.

(What one shouldn't do in professional code is mix languages arbitrarily, switching seemingly at random. The same thing should have the same name throughout the entire source code)


---

### Answer by username_11 on 2023-06-01. Score: 3

In my experience, it is in general hugely unreasonable to expect non-native middle schoolers to have any decent vocabulary of English. Granted, the English used in programming is not English in its entirety but it is still a lot to learn. Pinyin works fine for now, let them be.

To put things in perspective, non-native middle schoolers may be tested on 1000~2000 English words. Obviously not everyone will know all of them, and even less of them well. Even if English used in programming is very limited, there might still be a few hundred words that is commonly used. Asking the students to know them well is too much.

But make no mistake, English is the *de facto* standard language, and it should be made clear to them they should learn some English if they want to pursue programming further. The reasons why are innumerable

### Official documentation, books and tutorials

Not knowing the vocabulary will limit the resources available to you. It is simply a fact that English resources are currently the best.

### Googling and Stack Exchange

The fact that you're asking *here*, instead of say zhihu, is proof that knowing English is a great advantage. If you google in English, you get Stack Overflow. You'd be surprised how many people googled the wrong keywords, found nothing and gave up.

### Standard libraries and builtins

These are not changeable and all of them relies on English. For example, in C++ it is *required* that your member functions are `begin` and `end` to enable range based for loops.

### Tooling

There are tooling that relies on how English works. For example, pytest uses `test_*` and `Test*` as a signature that the objects are items for testing purposes.

The list goes on. As you might imagine, software *really* **really** cares about consistency.

Using Unicode characters is even worse for tooling:

* Regex support for non-ascii characters is usually poor to non-existent.
* Go (the language) uses uppercase letters to indicate exported names.
* The way whitespace plays with different languages is hugely variable.
* Languages going from right to left is likely impossible to work with for many tools.

> **Comments:**
> **username_16**: Sometimes I wonder why everything is in English. Then I realise, the non English stuff does not come up in by searches.  
> **username_0**: The only thing I can add is to these words "The fact that you're asking here, instead of say zhihu..." I asked here instead of zhihu or quora is because I am an active user of SE and I think it is the best, say far better than quora, although I hate close-vote and down-votes without any comments.  

---

### Answer by username_13 on 2023-05-31. Score: 2

You didn't mention what programming language(s) you're working with, but the way [PowerShell](https://en.wikipedia.org/wiki/PowerShell) names things might be helpful here.

Functions have names like [`Get-Process`](https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Management/Get-Process), [`Clear-ItemProperty`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/clear-itemproperty), [`Write-Host`](https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Management/Get-Process), etc. They're all of the form "verb dash noun". There's a predefined [list of verbs](https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands) that they encourage you to use whenever possible. When naming function parameters, they have predefined [lists of common parameter names](https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/standard-cmdlet-parameter-names-and-types) along with their standard meaning.

PowerShell does this for the sake of consistency, but an approach like this could help a non-native speaker as well. Those lists of words can be augmented with a description in their native language. Naming something consists of selecting the relevant noun and verb from the list (substituting a native language word when needed). Over time, the students will learn the vocabulary and not need the lists any more. Since they're using the same standard words as the built-in system functions, they're also learning how to interpret those functions without needing to look up and translate their documentation.

I'm not necessarily saying that you should teach them using PowerShell (that sounds quite awful, actually). You can follow a similar idea and create a naming convention for whatever language you're using. You'll have to build your own noun/verb lists, but you'll have the opportunity to fine-tune them based on your specific curriculum and assignments.

Standard library functions frequently have cryptic names, but you can create a helper header/library that provides wrappers around the relevant functions using the common naming convention. My CS teacher actually did that for us even though there wasn't a language issue. It helped focus on *concepts* instead of a specific language's library syntax, simplified many interfaces, and gave the instructor a place to inject helper code that made grading easier or that simulated errors.

You can strip back the layers in a more advanced course, after they're comfortable with the fundamentals.

> **Comments:**
> **username_0**: Thanks for the information. I think I will try that. BTW, it also reminds me of my Objective-C days. Apple has some guidelines for naming  https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html  
> **username_14**: This [comment](https://cseducators.stackexchange.com/questions/7757/non-native-english-speakers-struggle-to-come-up-with-decent-variable-names-and-f#comment21210_7758) above is worth noting  
> **username_15**: (Many of the common PowerShell cmdlets [also have aliases](https://pvm-professionalengineering.blogspot.com/2019/10/powershell-aliases-and-missing.html), e.g., `ps` for [Get-Process](https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Management/Get-Process) (like on Linux/Unix))  

---

### Answer by username_16 on 2023-06-01. Score: 1

# Some simple rules.

* Design the code to be readable
  + Use the language of the domain: use the business language and natural language of the project. Most languages support unicode. e.g. `火出口` (it says fire exit in very bad Chinese: literally file exile mouth).
  + When naming things consider how they are used, over what they do: Consider what how they will look when used: e.g. `if cat.height > 3*meters then direction.set(away from cat), run(fast)`

To help with this:

* Actions should have verb-phrases for names. e.g. `run`, `stop`, `open`.
* Booleans, and functions returning a boolean should have an adjective-phrase. e.g. `is running`, `is open`.
* Non boolean objects, and functions returning such, should have noun-phrase names. e.g. `cat`, `door`, `big cat`.
* Sometimes you will need enumerations to pass in to a procedure, these will often be adverbs. e.g. `quickly`.

Most of this is general advice. However back to the non-English and English speaker. So if they can type their native language, then do that. I cannot think of a language that does not support Unicode names. E.g. these do support it: `C`, `python`, `rust`, [`scratch`](https://scratch.mit.edu/), …


---

### Answer by username_17 on 2023-05-31. Score: 1

As others say, good naming is hard even for native English speakers.

I don't think there is a straightforward curriculum to follow that makes one good at naming, or a simple criteria against which to measure success.

At the stage of learning programming, when there is still plenty to learn, it might not be important for chosen names to always be great names.

However, I would suggest having regular discussion about the importance of naming, and have examples of good naming schemes for pupils to consider and absorb.

A pre-requisite for naming in English is to be deeply familiar with English. Exposure to a large amount of vocabulary, and examples of existing software naming schemes are also useful.

To become skilled at naming, a person generally has to be interested in language, to some degree for its own sake.

Some others here have also said names don't matter too much in programming. That can be true in limited cases, but as a general statement nothing could be more preposterously false.

> **Comments:**
> **username_14**: Good points! As to importance of naming: Naming is about *best-practice.* Beginning students have a hard time knowing that `else` goes with `if` not `while` (unless you're in Python!), that conditions must be parenthesized (C family) or terminated by ':' (Python).  Zillions of such minor points that experienced programmers have struggled understood internalized *and forgotten the struggle*.  
> **username_14**: In that context a foreign unfamiliar language is a heavy gratuitous burden. In short: naming is fundamental to *software engineering.* But theres a big gap noob-programming↠ SE. See my [pianist-analogy](https://cseducators.stackexchange.com/a/6164/8837)  
> **username_17**: @Rusi, the "while-else" is an exemplar of dreadful English naming! But yes, even with English itself, there is a process of schooling in which children learn alphabetic symbols and punctuation and all the rest of it. Meanwhile, vocabulary and word choice is largely learned from everyday listening and reading.  

---

