14

In programming, which spelling—adapter or adaptor—is standard or de facto standard? Is there a difference between them?

In boost I see "adaptor", whereas in literature I see "adapter".

Which one is preferred in code?

Aditya W
  • 652
  • 8
  • 20
Anycorn
  • 50,217
  • 42
  • 167
  • 261
  • It's possible the libraries in question were written by a non-american, resulting in the selection of non-american spelling. As to which spelling is preferred in code, it depends who's going to be reading your code. If your code is going to be read and maintained by, say, canadians, you should probably stick with canadian spelling. – Frank Farmer Jan 16 '10 at 05:55
  • Neither spelling is non-American! – Eric Mickelsen Jan 16 '10 at 06:02

10 Answers10

11

They are both correct, though I think there's a slight preference for adapter to be used for people (such as someone who adapts a piece of music), while adaptor is used for a device or machine; thus, in computing, adaptor would generally be used. Wikipedia mentions this distinction, though without any real references to back it up. I would use whichever you feel more comfortable with, or the one in already in use in the code base you're working in if the word has been used already.

Brian Campbell
  • 322,767
  • 57
  • 360
  • 340
8

It is spelled Adapter in the 'Gang of Four' book (page 139) which is often considered definitive.

The term would usually be spelled Adaptor in British English.

A full reference for the 'Gang of Four' book is:

Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma (Author), Richard Helm (Author), Ralph Johnson (Author), John Vlissides (Author)

Thomas Bratt
  • 48,038
  • 36
  • 121
  • 139
  • 1
    It is not true that it is a British English spelling. See: http://grammarist.com/spelling/adapter-adaptor/. Both variations of English use Adapter more. – Clintonio Oct 06 '14 at 09:38
  • 1
    yeah, but page 144 of that book mentions "Instead, ObjectWorks\Smalltalk includes a subclass of ValueModel called PluggableAdaptor. " and then next paragraph "Another example from ObjectWorks\Smalltalk is the TableAdaptor class." which is what brought me here. They spell it Adapter in most of the book, but then illustrate a use case where it is Adaptor on page 144. Confusing... – luckyguy73 May 18 '19 at 15:03
6

As an Aussie, I spell it Adaptor (an Adapter is a person who adapts, an adaptor is a device that performs adaptation). My teammate (who is Kiwi) spells it Adapter (which makes our code 'interesting' at times). The Yanks I know spell it Adapter, and I have no idea what the Poms use! It's obviously a dialectic thing.

If your programming language supports unicode, name it with a schwa j/k

Mark
  • 3,372
  • 2
  • 16
  • 14
4

Your choice of language might be meaningful here -- the C++ standard and Boost use "adaptor", Java uses "adapter".

Tudor Bosman
  • 61
  • 1
  • 5
3

I use adapter, because that's the correct spelling :) but i guess if you're not from the US the correct spelling might be adaptor.

http://en.wikipedia.org/wiki/Adapter

John Boker
  • 82,559
  • 17
  • 97
  • 130
1

I think you'll see "adapter" more commonly. Either is correct, so it's really up to you. The design pattern in particular seems to be spelled adapter. But, if you look at the wikipedia article on it (http://en.wikipedia.org/wiki/Adapter_pattern), it's spelled adaptor in the diagrams! Frankly, I don't see any justification for spelling the word adaptor in the first place, but English is a funny language that way.

Eric Mickelsen
  • 10,309
  • 2
  • 30
  • 41
  • 1
    "I don't see any justification for spelling the word adaptor". To some extent it's a Latin vs Germanic thing: actor, director, author, vs. player, leader, writer. The verb "adapt" is from the Latin verb, adaptare, so the Latin -tor suffix seems justified to me (if arbitrary, since the -er suffix means the same thing). But then I'm English, so I instinctively want to spell it adaptor anyway ;-) – Steve Jessop Jan 16 '10 at 17:53
  • That's a very good point. Is it possible though that this is nullified by the fact that the word comes to us via Middle French rather than being a direct Latin loan-word? – Eric Mickelsen Jan 24 '10 at 06:46
1

Specific to Android, the spelling should be adapter, in order to keep it consistent with the framework:

android.widget.ListAdapter
android.bluetooth.BluetoothAdapter
android.support.v4.view.PagerAdapter
android.widget.SpinnerAdapter
android.nfc.NfcAdapter
friederbluemle
  • 33,549
  • 14
  • 108
  • 109
0

Most references say “adapter” and “adaptor” are interchangeable. If they are completely interchangeable, then why have two words?

Websters defines the suffixes, and they seem virtually identical except that “er” applies more universally:

  • “er”: A person or thing that does an action indicated by the root verb.
  • “or”: One that does a (specified) thing

I choose “adapter” as the preferred spelling, but I acknowledge that it is personal preference.

A different word, “adopter”, would be considered misspelled as “adoptor” (see spellchecker.net/misspellings/adoptor).

Further, a “conductor” would be considered misspelled as “conducter”, regardless of whether referring to person leading a musical group or a thing transferring electrical current.

-1

As some people here have already pointed out, the correct spelling is adaptor. Just because Americans have bastardised (Note: it's not bastardized either) the English language and constantly attempt to bleed it into all of their computer applications and media, among other things, does not make them right. :)

Anon
  • 1
  • 1
  • 1
    once upon a time i used to share that (rather prevalent) attitude, but i enjoyed a transformative moment when learning the history of the english language: as it turns out, the reason english is such a wildly successful language is that there is nothing "right" nor "wrong", not in spelling, not in grammar, as long as we can make ourselves understood. spelling, until relatively recent history, was as much an aesthetic choice as anything else, and as painful as it may be to hear this, american english is just as valid as our beloved flavours. – therightstuff Dec 19 '18 at 13:20