4

I am looking for a word to use in a class name (programming).

To make the example more meaningful in this community, let's say this is about language translating.

Let's say there is one class that is called EnglishToFrench, which can translate from English to French, and another class EnglishFromFrench (or FrenchToEnglish), which can translate from French to English.

Now I want to create a new class that can translate in both directions.

The best I can come up with so far is EnglishVsFrench. But this is not really it.

Is there anything closer to what I am looking for? Ideally something short and catchy..

Notes:

  • I think in my native language (German) there is no such preposition.
  • The real use case is something like type casting, so StringToObject, ObjectToString, String?Object. But don't spend too much thought on this.
7
  • EnglishToOrFromFrench
    – Drew
    Commented May 30, 2016 at 4:20
  • 1
    'Trom', says captain awkward.
    – donquixote
    Commented May 30, 2016 at 5:33
  • From a programming perspective, you now have a generalization from 1 source language to 2 possible source languages. As a next step you would probably want to generalize even further to n languages (in other words, what happens when you want to expand to add DE, JP, etc. into the mix?). In which case the class/method name would simply be Translate. Your source and/or target language would then be either arguments or type arguments (if using something like generics) - depending on your design and implementation, and taking the possibility of auto-detection of the source into account.
    – frIT
    Commented May 30, 2016 at 12:32
  • @fr13d In my example the ObjectVsStringInterface inherits from ObjectToStringInterface and StringToObjectInterface, so it gets two methods objectGetString() and stringGetObject(). An implementation represents a specific way to encode and decode an object as a string. The logic between the methods is symmetrical, but distinct. It would not make sense to throw it into the same method.
    – donquixote
    Commented May 30, 2016 at 16:10
  • @fr13d The naming scheme AToB or AFromB is a bit unconventional, and I am not 100% sure I will stick with it. But so far it allowed to name a lot of stuff without too much thinking. "Don't make me think" is always good advice. Throwing a verb in there like AToBConverterInterface adds implications about the implementation, which atm I think is not desirable. E.g. maybe it is just a lookup, not a conversion. On the other hand, such a verb also describes the relation between the string and the object, which could be desirable. Either way, the question should stay as in its initial form.
    – donquixote
    Commented May 30, 2016 at 16:15

5 Answers 5

6

No, I don't believe there is such a preposition. I had a quick look at the list of English prepositions at Wikipedia, but I didn't see anything suitable.

You could use "ToOrFrom", or make up your own preposition: "ToFrom".

Personally I would just call the class EnglishFrenchTranslator.

1
  • Ok, I am going to accept this answer because the suggested words can be used in class names in all common programming languages. <>, not so much. But this does not make the other answer wrong. I just need to pick one. Thanks!
    – donquixote
    Commented May 30, 2016 at 4:11
2

Translators use: English<>French; or French<>English. To answer your question, no there is no such preposition. Short and catchy? For a preposition?

The idea of <> can be expressed by the word bi-directional. That would work in programming, too. Something that works in two directions...

0
1

I would use "BetweenEnglishFrench". To me that indicates both or either direction. According to Purdue OWL (https://owl.english.purdue.edu/owl/resource/730/1/) "between" is a preposition.

2
  • In English, between English French is meaningless, actually. Between English AND French.
    – Lambie
    Commented May 30, 2016 at 13:45
  • @Lambie I think you meant that it is not grammatical. But it would work great as a class name in a programming language which is what the question asks. Someone who saw that class name in a program would certainly find it meaningful.
    – adg
    Commented May 31, 2016 at 3:57
0

To and fro: He moved to and fro. (Back and forth)

3
  • Great suggestion, but the OP wants just one word.
    – user140086
    Commented May 30, 2016 at 9:44
  • to_and_fro :P or if you're a JS kind of guy toAndFro sorry I tried, pls notice me Mr./Ms./Mss. OP Commented May 30, 2016 at 9:48
  • To and fro suggests a track or table. A stroke as they say in mechanics. Translation doesn't work that way.
    – Lambie
    Commented May 30, 2016 at 18:02
0

I've always found Toggle works well

So, in your case toggleEnglishFrench

toggle ˈtɒɡ(ə)l/ noun 1. a short rod of wood or plastic sewn to one side of a coat or other garment, pushed through a hole or loop on the other side and twisted so as to act as a fastener. 2. COMPUTING a key or command that is operated the same way but with opposite effect on successive occasions. verb 1. COMPUTING switch from one effect, feature, or state to another by using a toggle. "the play/pause button toggles between those functions" 2. provide or fasten with a toggle or toggles. "our horses were hobbled or toggled before they were turned out to graze"

3
  • toggle is this or that.
    – Lambie
    Commented May 30, 2016 at 18:01
  • 1
    I disagree, it's similar but a subtle difference. Toggle is to switch between this or that. So toggle French English would toggle between the two,depending on what the start language was.
    – RemarkLima
    Commented May 30, 2016 at 18:04
  • 2
    In my understanding, toggle implies that something can have one of two states, and can switch between these states. Not exactly the same. But maybe it is useful to someone.
    – donquixote
    Commented Jun 7, 2016 at 17:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .