Personally, once you have more than two humps in your camel case, my eyes have trouble scanning.
Personally, once you have more than two humps in your camel case, my eyes have trouble scanning.
HWND hwnd = CreateWindow("MainWClass", "Sample",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
(HWND) NULL, (HMENU) NULL,
hinstance, (LPVOID) NULL);
And here's a long method call in Objective-C: NSString *filtered = [unfiltered stringByReplacingOccurrencesOfString:@"verbose"
withString:@"explicit"
options:NSCaseInsensitiveSearch
range:NSMakeRange(0, [unfiltered length])];
Admittedly not equivalent examples, but I couldn't quickly find a Cocoa method call with eleven parameters. My argument is that if you're not intimately familiar with these two calls, CreateWindow() is pretty cryptic. You only get the most general sense of what it's doing without consulting a reference. Objective-C's strange method naming scheme (taken from Smalltalk) makes complex method calls much easier to understand in situ. NSString *filtered = [unfiltered replace:@"verbose"
with:@"explicit"
options:CaseInsensitive
range:Range(0, [unfiltered length])];
Of course, I'm making assumptions about what those parameters mean. But I find this much more clear, assuming the intentions are what I think they are.On the second line, you didn't mention at all what is passed in.
For the last two, removing the NS prefix would work if Objective-C had some kind of namespacing support. Currently it doesn't, so the NS prefix is kinda needed.
I'm not sure what you mean by not mentioning what is passed in. Keep in mind: I have never programmed in Objective-C. I am going on intuition alone.
No namespace support is a bummer - it means you're going to end up with long identifiers all over the place.
Allow me to introduce you to NSBitmapImageRep, which holds the dubious honor of being initialized by the longest public selector in all of Cocoa. Here's a contrived example:
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:data
pixelsWide:640 pixelsHigh:480
bitsPerSample:8 samplesPerPixel:3
hasAlpha:NO isPlanar:YES
colorSpaceName:@"NSCalibratedRGBColorSpace" bitmapFormat:NULL
bytesPerRow:0 bitsPerPixel:0];
edit: formatting