views:

1610

answers:

5

Since I started learning Objective C and Cocoa, I've been wondering why did they choose the extension .m for the implementation files - was it supposed to mean something, or was it just a random letter? Does anyone know? I couldn't find such information anywhere on Google...

+7  A: 

From the first Google result (Wikipedia entry) for "objective c" file extension:

The interface only declares the class interface and not the methods themselves; the actual code is written in the implementation. Implementation (method) files normally have the file extension .m.

ssg
+2  A: 

.m files contain the (m)ethods. Possible reason?

baker1990
+33  A: 

Today most people would refer to them as "method files", but

"The .m extension originally stood for "messages" when Objective-C was first introduced, referring to a central feature of Objective-C [...]"

(from the book "Learn Objective-C on the Mac" by Mark Dalrymple and Scott Knaster, page 9)

EDIT: To satisfy an itch I emailed Brad Cox, the inventor of Objective-C, about the question and he answered with this single line:

"Because .o and .c were taken. Simple as that."

splattne
+2  A: 

It stands for "methods". From the comp.lang.objective-C FAQ:

The organisation of Objective-C source is typically similar to that of C or C++ source code, with declarations and object interfaces going into header files named with a .h extension, and definitions and object implementations going in files named with a .m (short for methods) extension.

Adam Rosenfield
+1  A: 

Haha. I always thought that they were named that way because of the "em" sound of (im)plementation. It good to know that just stood for "methods" all this time.

Earl Claridad