Plea for Naming in Simple English

The naming of elements in Swift is often a point of extended discussion. A recent example is the discussion about the cases for the Result type.

In the server logging discussion there was suggested to add a log level above error where fatal or fault was suggested. For me it is clear that it has to be fatal. Why? Because I am not a native speaker. What’s worse, a device in fault state or one in error state? I cannot tell (both translate to “Fehlerzustand” in German). But I am quite confident that a fatal situation is worse than an error state.

Also, if possible, use common words. NSURLSession uses ephemeralSessionConfiguration. I doubt we ever used “ephemeral” in school. I had to look it up. We surely used “short-lived” or “temporary”. Why was it not called temporarySessionConfiguration? Well, too late.

Long story short: When naming things, keep in mind that Swift is used in education, by minors, by non-native-speakers. Use clear, simple English when naming things. It’s a programming language, not literature.

4 Likes

Swift's naming guidelines already suggest using the common names for things. However, when there is no common name, or the common name is unavailable or not descriptive enough, more uncommon names must be used. For example, temporary already has a common connotation in app programming, similar to the temporary directory. That does not match the use of ephemeral in this case which, though less common, more accurately describes the in-memory only nature of the ephemeral session. Since this is a case by case issue I suggest you offer your naming feedback on the cases you feel strongly about.

6 Likes

Ich hätte error mit fehler und fatal mit abstürzend übersetzt.
I would have translated error as fehler and fatal as abstürzend.


Ich finde die Idee von eine sogenannte „Einfaches [beliebige Sprache einsetzen]“ aüßerst unhilfreich. Je präziser der Wortschatz, desto weniger Homonymen und Amiguitäten existieren.
I find the idea of a so‐called “Simple [insert some language]” to be extremely unhelpful. The more precise the vocabulary, the fewer homonyms and ambiguities exist.

Denke mal über die letzten zwei Sätze nach. Für einen deutschen sechsjähriger ist der erste Satz viel leichter zu verstehen, denn die Wörter sind kurz und werden früh gelernt. Bei den zweiten Satz muss er wahrscheinlich ein Wörterbuch aufschlagen.
Consider the previous two sentences. For a German six‐year‐old the first sentence is much easier to understand, because the words are short and are learned early. But at the second sentence he will need to crack open a dictionary.

Aber als Zweitsprachler, werden mir im ersten Satz viele Fallen gestellt:
But as a second‐language speaker, the first sentence contains many traps:

  • „finden“ → Wir suchen Ideen?!?
    “finden” → We are looking for ideas?!?

  • „sogenannte“ → Warum sind wir dabei, etwas zu nennen?
    “sogenannte” → Why are we naming something?

  • „aüßerst“ → Wer aüßert Unhilfe?
    “aüßerst” → Who is expressing unhelpfulness?

Beim zweiten Satz dagegen gibt es nichts unverständliches. „Präzision“, „Homonym“ und „Ambiguität“ zwingen mich vielleicht zum Lexikon oder Enzyklopädie, aber dort finde ich sofort exact die Antwort die ich suche. Keines der beiden Bücher kann mich mit dem ersten Satz helfen.
But in the second sentence there is nothing to misunderstand. “Präzision”, “Homonym” and “Ambiguität” might force me to the dictionary or encyclopedia, but there I will immediately find exactly what I am looking for. Neither book can help me with the first sentence.


Ephemer“ ist übrigens auch ein deutsches Wort – und wird zwar in mehreren Bereichen verwendet.
By the way, “ephemer” is also a German word used across several diciplines.


Perfect advice.

1 Like

I’m also a non-native speaker and I used to translate technical literature from English, so I feel your pain. But I am afraid there are already too many constraints on naming to solve this issue in a satisfactory fashion. Simpler terms are a good default we should strive for, but they also often have other, conflicting meanings or are too generic to be useful and precise. And the more complex vocabulary often comes from other languages or mathematics, which actually makes it easier to understand for many people. ¯\(ツ)

(After all, it’s often said that the only two really hard things in programming are naming, cache invalidation and off-by-one errors.)

7 Likes

Thanks to all of you for your answers.

I will follow your advice and rise my hand if I see the need.

5 Likes
Terms of Service

Privacy Policy

Cookie Policy