News for hackers. Stuff that matters.
Re:Annoyances of API Design by Rockslide on Thursday January 28, 2016 @12:21PM (#10989559)
The Objective-C example is not even close to the worst case :) I raise you

    shapeEffectSingleBlurFrom:withInteriorFill:offset:blurSize:innerGlowRed:innerGlowGreen:innerGlowBlue:innerGlowOpacity:innerShadowRed:innerShadowGreen:innerShadowBlue:innerShadowOpacity:outerGlowRed:outerGlowGreen:outerGlowBlue:outerGlowOpacity:outerShadowRed:outerShadowGreen:outerShadowBlue:outerShadowOpacity:hasInsideShadowBlur:hasOutsideShadowBlur:
(as queried with https://github.com/leoschweizer/Heliograph )
Re:Annoyances of API Design by pavlov on Thursday January 28, 2016 @02:32PM (#10990568)
Since nobody uses Obj-C without Xcode, you actually never need to type out a long method name. Typically you'd just write "sha", Xcode will autocomplete the method, and you press Tab to fill out all those parameters. Seeing them all at once as part of the method name is pretty convenient.

I'm not saying that the method name in your example makes any sense, it's definitely insanely long... But the Apple API mentioned in the original post is OK in my books because it's a rarely used initializer for a low-level object. It essentially wraps a raw C pointer into an object, so of course it needs all that metadata about what the pointer is! Putting the same data in a struct wouldn't save any typing.

Re:Annoyances of API Design by wingerlang on Thursday January 28, 2016 @11:34PM (#10993519)
Sometimes I write it in Sublime. Although even then, I sometimes just write the method in Xcode to get the autocomplete then copy paste it, or just open the non-xcode-project file in xcode.
Re:Annoyances of API Design by girvo on Friday January 29, 2016 @10:02PM (#11000292)
> Since nobody uses Obj-C without Xcode

Hey now, I do! But I'm convinced that I'm subconsciously some kind of masochist, so that's probably not proving you wrong.

Re:Annoyances of API Design by dilap on Thursday January 28, 2016 @11:18PM (#10993468)
hey now, I edit objc in emacs all the time!
Re:Annoyances of API Design by hohenheim on Friday January 29, 2016 @07:29AM (#10994816)
I'm sorry but that sounds like a horrible excuse. Not only you are bound to a platform but also an IDE.
Re:Annoyances of API Design by bigblind on Thursday January 28, 2016 @01:02PM (#10989914)
Let's create the "Tweetable API" movement. If the most common call of a function doesn't fit in a tweet, you're probably doing it wrong.
Re:Annoyances of API Design by JadeNB on Thursday January 28, 2016 @03:05PM (#10990803)
> If the most common call of a function doesn't fit in a tweet, you're probably doing it wrong.

As with all metrics, that can be gamed. Would

    s:o:b:iGR:iGG:iGB:iGO:iSR:iSG:iSB:iSO:oGR:oGG:oGB:oGO:oSR:oSG:oSB:oSO:I:O:
(the same arguments, obfuscated), which comes in at a much-reduced character count of 75, be any better?
Re:Annoyances of API Design by PeCaN on Thursday January 28, 2016 @03:10PM (#10990848)
Well then we can just add "if you have to abbreviate your function name and arguments for the common form to fit in a tweet, you're probably doing it wrong".
Re:Annoyances of API Design by JadeNB on Thursday January 28, 2016 @03:32PM (#10991056)
> "if you have to abbreviate your function name and arguments for the common form to fit in a tweet, you're probably doing it wrong".

There go all my Unix commands! (OK, that is an uncharitable interpretation—changing `mv` to `move` wouldn't overflow a tweet—but it does indicate, I think, that it's not always obvious when an abbreviation is reasonable.)

Re:Annoyances of API Design by cellularmitosis on Thursday January 28, 2016 @09:00PM (#10993012)
Those abbreviation decisions were made in the early 1970's. How does that indicate the non-obviousness of deciding when it is or is not appropriate to use abbreviations today?
Re:Annoyances of API Design by JadeNB on Thursday January 28, 2016 @10:30PM (#10993298)
I was writing from the point of view of someone who finds Unix abbreviations perfectly acceptable (as compared to my comically abrogated SmallTalk / Objective-C (I don't even know which) invocation above (https://news.ycombinator.com/item?id=10990803), which I'd say is clearly not acceptable). Certainly, my argument will not be convincing to someone who doesn't share that point of view.
Re:Annoyances of API Design by stepanhruda on Thursday January 28, 2016 @05:23PM (#10991902)
Unix is incredibly guilty of this. Everything would be so much easier to learn if mv was generally aliased to move and all code examples used the long version.
Re:Annoyances of API Design by JadeNB on Thursday January 28, 2016 @08:06PM (#10992785)
> Everything would be so much easier to learn if mv was generally aliased to move and all code examples used the long version.

I dunno; Tim Berners-Lee has said that his single biggest mistake was including two slashes in URLs (as in http://news.ycombinator.com, as opposed to http:/news.ycombinator.com). (I can't find any better citation for this than http://www.plughitzlive.com/theupstream/298-creator-of-the-w..., unfortunately.) I think that one shouldn't underestimate the apparently negligible impact of an extra character or two, if there will be millions of people typing those extra characters potentially many times a day, over the course of decades or centuries.

(Actually, now that I read your post more carefully, you say that `mv` should be aliased to `move`, meaning, I assume, that `mv` would also be available. I am still unsure about that, because most people would never bother to learn the short version—witness how many people don't know keyboard shortcuts for their most commonly used programmes—but I guess the experts would, and that, perhaps, is enough.)

Re:Annoyances of API Design by drostie on Friday January 29, 2016 @12:22PM (#10996660)
It wasn't too hard to track down the quote; it is:

http://library.fora.tv/2009/10/08/Next_Decade_Technologies_C...

He wasn't even saying that the // should be a single /, he was saying that the : at the end of the protocol identifier is already sufficient. He wanted something more like:

    http:news.ycombinator.com/
Re:Annoyances of API Design by oldmanjay on Thursday January 28, 2016 @08:35PM (#10992901)
I'm totally onboard with saving two keystrokes. I don't have all second to move this file.
Re:Annoyances of API Design by JadeNB on Thursday January 28, 2016 @10:28PM (#10993292)
Don't listen to me—I don't know anything about good API design. (That's not sarcasm or modesty, but the simple truth.) However, if the self-diagnosed biggest mistake of Tim Berners-Lee's life was to add a single extra character to a commonly typed string, then surely one has to consider that the addition of two extra characters could eventually also be judged a mistake?
Re:Annoyances of API Design by stepanhruda on Friday January 29, 2016 @07:39PM (#10999782)
From my point of view, he wasn't saying it because it's an extra character, but because http://news.ycombinator.com is more cryptic and harder to understand than http:news.ycombinator.com.

That fits into my belief that more readable (move instead of mv) is better.

Re:Annoyances of API Design by Rockslide on Thursday January 28, 2016 @03:12PM (#10990897)
In iOS 9, there currently seem to be 45 methods whose selector alone is longer than 140 characters. But how many of those are actually supposed to be used is another question ;)
Re:Annoyances of API Design by makecheck on Thursday January 28, 2016 @12:47PM (#10989788)
I would guess that this method was created by a code generator, starting from a data structure with all of those fields.

More generally, a long initializer (or class method that returns an autoreleased object) is a fairly common pattern in Objective-C because it provides a common piece of code that all other initializers can call. There is usually some more obvious and convenient choice available, to avoid calling the horrible method directly.

Re:Annoyances of API Design by cpeterso on Thursday January 28, 2016 @06:09PM (#10992257)
Windows is known for having some rather long API names, such as RtlWriteDecodedUcsDataIntoSmartLBlobUcsWritingContext or EapHostPeerQueryUIBlobFromInteractiveUIInputFields. More examples at:

http://ashutoshmehra.net/blog/2010/02/long-function-names/