5 ms·
The Objective-C example is not even close to the worst case :) I raise you shapeEffectSingleBlurFrom:withInteriorFill:offset:blurSize:innerGlowRed:innerGlo
by Rockslide 11y ago
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 https://github.com/leoschweizer/Heliograph )
- makecheck 11y agoI 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.
- bigblind 11y agoLet'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.
- JadeNB 11y ago> 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?
- PeCaN 11y agoWell 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".
- JadeNB 11y ago> "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.)
- stepanhruda 11y agoUnix 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.
- JadeNB 11y ago> 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 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-world-wide-web-apologizes-for-extra-slash.html 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.)
- oldmanjay 11y agoI'm totally onboard with saving two keystrokes. I don't have all second to move this file.
- Rockslide 11y agoIn 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 ;)
- pavlov 11y agoSince 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.
- dilap 11y agohey now, I edit objc in emacs all the time!
- wingerlang 11y agoSometimes 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.
- hohenheim 11y agoI'm sorry but that sounds like a horrible excuse. Not only you are bound to a platform but also an IDE.
- girvo 11y ago> 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.
- cpeterso 11y agoWindows 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/ http://ashutoshmehra.net/blog/2010/02/long-function-names/