Many classes in Cocoa/Cocoa Touch have the NS prefix. What does it mean?
It stands for NextSTEP, the operating system that Steve Jobs (caused to be) built after he was evicted from Apple. Objective-C and the NextSTEP API are the basis of the newer OpenSTEP and MacOS-X APIs.
The Cocoa frameworks. The classes in Foundation provide objects and functionality that are the basis, or “foundation,” of Cocoa. The classes in Application Kit furnish the objects and behavior that your users see in the user interface, such as windows and buttons, and handle their mouse clicks and key presses.
The original code for the Cocoa frameworks came from the NeXTSTEP libraries Foundation and AppKit (those names are still used by Apple's Cocoa frameworks), and the NextStep engineers chose to prefix their symbols with NS.
Because Objective-C is an extension of C and thus doesn't have namespaces like in C++, symbols must be prefixed with a unique prefix so that they don't collide. This is particularly important for symbols defined in a framework.
If you are writing an application, such that your code is only likely ever to use your symbols, you don't have to worry about this. But if you're writing a framework or library for others' use, you should also prefix your symbols with a unique prefix. CocoaDev has a page where many developers in the Cocoa community have listed their "chosen" prefixes. You may also find this SO discussion helpful.
It's from the NeXTSTEP heritage.
NeXTSTEP or NeXTSTEP/Sun depending on who you are asking.
Sun had a fairly large investment in OpenStep for a while. Before Sun entered the picture most things in the foundation, even though it wasn't known as the foundation back then, was prefixed NX, for NeXT, and sometime just before Sun entered the picture everything was renamed to NS. The S most likely did not stand for Sun then but after Sun stepped in the general consensus was that it stood for Sun to honor their involvement.
I actually had a reference for this but I can't find it right now. I will update the post if/when I find it again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With