• Nick (unregistered)

    Half the problem is the shit that is Objective-C

  • (cs)

    Erm... wat?

  • arnebart (unregistered)

    Cocoa isn’t exactly known for its terse method names, but this might be stretching it.

  • gnasher729 (unregistered) in reply to Nick

    It's a bit on the long side for a method name, but nothing really wrong with it once you get used to Objective-C. The Xcode editor will format both the method declaration and any method calls nicely for you. It's not as if you ever have to type it yourself again after typing the declaration. And all parameters are nicely named, so it's not like in C, C++ or Java where you get yourself into deep trouble if you forget a parameter.

  • ANON (unregistered)

    Don't know Objective-C, but is the method name not just "updateCellWithLiveStreamId" and the rest the parameter list? That's no 400 letters.

  • submitter is the WTF (unregistered)

    Learn to read code, anonymous loser. That's a perfectly reasonable instance method declaration in Objective-C.

    Social media is the hot shit these days so any illiterate idiot can pretend to be a "software" "engineer" at a social media company, apparently.

  • fly (unregistered)

    Sorry , but method name is "updateCellWithLiveStreamId" , which is 26 chars long , method declaration on the other hand is over 400 chars long.

    No WTF here

  • (cs) in reply to ANON

    Not really, because Obj-C makes the parameter list part of the method name. So:

    fooWithA:(int) andB:(int)
    is a completely different method from
    fooWithA:(int) andC:(int)
    . Part of this arises from the fact that in Obj-C, you're going to name the parameters as you pass them-

    [object fooWithA:5 andB:6]; [object fooWithA:5 andC:12];

    Technically, you're not calling a method- you're passing a message.

    Now, that's weird, but it gets weirder. First off, Obj-C is entirely compatible with C, which means you'll still need to invoke C methods with the more traditional method-call syntax (instead of this "message pass" syntax). And there's no compile-time guarantee that you're passing a valid message, since you can configure classes to automatically delegate unfamiliar messages to other objects- so if class Whatever doesn't have a method for "doStuff", and I try [whateverInstance doStuff], I won't get a compile time error- because that instance might be delegating the doStuff message to another object.

    All this is to say: Objective-C is TRWTF (I actually like the language, but it's a weird little Galapagos finch of languages).

  • QJo (unregistered)

    Disgraceful. 8 character subroutine names was good enough for we engineers programming in FORTRAN 77 on the VAX, it's good enough for you pesky kids. Think yourselves lucky you doing have to program in FORTRAN 4 in which you're limited to 6 character identifiers, uppercase only and the arithmetic IF.

    Bah. You kids of today, don't understand the first thing about programming. GOML.

  • feugiat (unregistered)

    One line of code. No WTF.

    Worst. Article. Ever.

  • RFoxmich (unregistered) in reply to QJo
    QJo:
    Disgraceful. 8 character subroutine names was good enough for we engineers programming in FORTRAN 77 on the VAX, it's good enough for you pesky kids. Think yourselves lucky you doing have to program in FORTRAN 4 in which you're limited to 6 character identifiers, uppercase only and the arithmetic IF.

    Bah. You kids of today, don't understand the first thing about programming. GOML.

    Absolutely. The method basename updateCellWithLiveStreamId Should have been UCWLSID

    That's pretty clear right? And one character to spare in case you need to 'overload it' you can use e.g. UCWLSID1 etc.

  • anon (unregistered) in reply to fly
    fly:
    Sorry , but method name is "updateCellWithLiveStreamId" , which is 26 chars long , method declaration on the other hand is over 400 chars long.

    No WTF here

    No, you and others don't understand Objective C messages. This is the full message name:

    updateCellWithLiveStreamId:entityKey:imageUrl:title:sponsor1ImageUrl:sponsor1ArtistUserName:sponsor2ImageUrl:sponsor2ArtistUserName:connectCount:commentCount:

    Now that's actually less than half the suggested "method name" length suggested in the article. Objective C messages, or "methods" if you like, have names split up into parts. So the full name includes parts of the message which take parameters. The parameter names do not have to match that part of the message.

    Long message names in Objective C are actually sane, the problem here is that some of those things like sponsor1X indicate that there could be Sponsor object defined somewhere, and so on, which would lead to the method taking far fewer arguments. This isn't a big WTF, it's just someone modelling their data in a crappy way.

  • Balu (unregistered) in reply to ANON
    ANON:
    Don't know Objective-C, but is the method name not just "updateCellWithLiveStreamId" and the rest the parameter list? That's no 400 letters.

    In Objective-C terms the entire parameter list is part of the method name. Take for example

    -(int)getNumberOfUsersWithFirstname:(NSString*)firstName AndLastName:(NSString*)lastName;
    

    That is the method name:

    getNumberOfUsersWithFirstName:AndLastName
    
  • ANON (unregistered) in reply to Remy Porter

    Ok, and I always thought VB is weird.

    Makes me hope that Android will prevail, I don't want to learn this language.

  • (cs)

    If you allow me to be pedantic (thank you), the method signature is not 402 characters long: parameter variable names are not part of the method signature, so it is "only" 158 characters long.

    Yeah, that's definitely a WTF, for one it's clearly the sign of a screwed-up model to be needing that many parameters. More than 8 is a sure sign for me that it's time to refactor.

    (however, I don't know where the "hash" thing comes from: the full ASCII string is not used when passing the message, but what is passed is a pointer to the signature string that was uniqued at process startup, not a hash).

    Addendum (2013-11-21 07:53): Oh, and let's not forget passing URLs as NSStrings and not, you know, as NSURLs, as they should, and other such assorted stupidity. Using longs? Have fun when they become 64-bit when iOS starts supporting 64-bit with LP64 model which will happen… two months ago with the iPhone 5S.

  • Sal Undy (unregistered) in reply to feugiat
    feugiat:
    Worst. Article. Ever.

    Hanzo would like a word...

  • Bob Hope (unregistered)

    I'm working on some objective C code, and some of the older practitioners seem to have a weird disease - why define a new object when you can just pass around a dictionary with a bunch of loosely defined key strings?

    It was probably a reasonable compromise when the code was small and not complicated, but complications have arisen, and now trying to graft more stuff onto that dictionary is problematic. It doesn't help that there are a few different dictionaries to pass around, and because all the method signatures are typed with "NSDictionary *", it's not obvious what you will break by trying to add some model objects.

    I also disagree with the people claiming this is not a WTF. I read objective c, and this method signature hurts my soul. Imagine how much it would be improved with only a single "sponsor" structure or class to pass in.

    -(void)updateCellWithLiveStreamId:(long)liveStreamId entityKey:(NSString *)entityKey imageUrl:(NSString *)imageUrl title:(NSString *)title sponsor:(WTFSponsor *)sponsor1 sponsor:(WTFSponsor *)sponsor2 connectCount:(long)connectCount commentCount:(long)commentCount;

  • nibh (unregistered) in reply to Sal Undy
    Sal Undy:
    feugiat:
    Worst. Article. Ever.

    Hanzo would like a word...

    Hanzo is ninja. Anonymouzo is nothing.

  • (cs)

    I've never seen such a heated argument in the comments before. Although it's the same two posts over and over and over so I don't think it counts.

  • quis (unregistered) in reply to Zacrath

    Could it be? The first time the editor of the article is as bat-shit clueless as the submitter of the alleged WTF?

    Hanzo would be a welcome improvement over this stinking pile of article.

  • Shaun Forsyth (unregistered) in reply to nibh

    Ah but surely the book of five rings says "Appear to be a ninja, but don't actually kill anyone"

  • foxyshadis (unregistered) in reply to quis
    quis:
    Could it be? The first time the editor of the article is as bat-shit clueless as the submitter of the alleged WTF?

    Hanzo would be a welcome improvement over this stinking pile of article.

    ObjC programmers are as full of Stockholm Syndrome as VBScript gurus: Once you get used to being abused you start to think it's OK, then that it's the one true way.

    Even in C++, the only time this would be remotely reasonable is a constructor that takes dozens of possible arguments. Anything else, you either set properties or break up your 1000-line omnifunction, you don't defend it.

    Stockholm Syndrome.

    /The Crying Game?

  • McKay (unregistered) in reply to feugiat

    One line of criticism. One line of comment.

    Worst. Comment. Ever.

  • McKay (unregistered) in reply to feugiat
    feugiat:
    One line of code. No WTF.

    Worst. Article. Ever.

    One line of criticism. One line of comment.

    Worst. Comment. Ever.

  • EvilSnack (unregistered) in reply to foxyshadis
    foxyshadis:
    Even in C++, the only time this would be remotely reasonable is a constructor that takes dozens of possible arguments. Anything else, you either set properties or break up your 1000-line omnifunction, you don't defend it.

    Stockholm Syndrome.

    I work in a C++ shop, and no, a constructor with more than a couple arguments would not be considered reasonable at all here.

  • (cs) in reply to Bob Hope
    Bob Hope:
    I also disagree with the people claiming this is not a WTF. I read objective c, and this method signature hurts my soul. Imagine how much it would be improved with only a single "sponsor" structure or class to pass in.
    A much neater solution indeed. I guess devs take this route because they only know about creating an instance in a XIB and haven't got the faintest clue on how to create their own class, or perhaps even how to allocate it...
  • Krunt (unregistered) in reply to feugiat
    feugiat:
    One line of code. No WTF.

    Worst. Article. Ever.

    If you think this is the worst, you've never read any of Hanzo's contributions.

  • Valued Service (unregistered)

    This is it?

    And I hit the Random Article button...

  • Davio (unregistered)

    Thank goodness for higher level app API's (like CodenameOne's Java API) which save me from programming in Obscure-C.

  • Qazwsx (unregistered) in reply to feugiat
    feugiat:
    One line of code. No WTF.

    Worst. Article. Ever.

    Nice try, Eric Gern.

  • (cs) in reply to Bob Hope
    Bob Hope:
    Imagine how much it would be improved with only a single "sponsor" structure or class to pass in.

    I can imagine something even better: a world where Objective-C doesn't exist.

  • ANON (unregistered) in reply to nibh
    nibh:
    Sal Undy:
    feugiat:
    Worst. Article. Ever.

    Hanzo would like a word...

    Hanzo is ninja. Anonymouzo is nothing.

    Hanzo Facts #1: If Hanzo coded that, the method name would have 800 letters.

  • Russell (unregistered)

    I don't see whats wrong with that code, it looks like idiomatic Objective-C to me. >:)

  • Anomaly (unregistered) in reply to ANON
    ANON:
    nibh:
    Sal Undy:
    feugiat:
    Worst. Article. Ever.

    Hanzo would like a word...

    Hanzo is ninja. Anonymouzo is nothing.

    Hanzo Facts #1: If Hanzo coded that, the method name would have 800 letters.

    Because four hundred letters would be a longwinded rant about ninja germans not being legit because they didnt read the book of five who fucking cares.

  • Krunt (unregistered) in reply to QJo
    QJo:
    Disgraceful. 8 character subroutine names was good enough for we engineers programming in FORTRAN 77 on the VAX, it's good enough for you pesky kids.

    8 character subroutine names? Aspirational capitalist market economy dog! In great nation of Foobaristan we use 4 character mnemonic names to identify method. If method is not instantly a recognition at character 4 length, program is not execute... you are execute!

  • Jellineck (unregistered) in reply to ANON
    ANON:
    Ok, and I always thought VB is weird.

    Makes me hope that Android will prevail, I don't want to learn this language.

    I'm working on a iPad application right now written in beautiful C#. No ObjC for this guy. Thanks, Xamarin.

  • QJo (unregistered) in reply to Krunt
    Krunt:
    QJo:
    Disgraceful. 8 character subroutine names was good enough for we engineers programming in FORTRAN 77 on the VAX, it's good enough for you pesky kids.

    8 character subroutine names? Aspirational capitalist market economy dog! In great nation of Foobaristan we use 4 character mnemonic names to identify method. If method is not instantly a recognition at character 4 length, program is not execute... you are execute!

    +1 (applause)

  • Paul Neumann (unregistered)

    Objective-C: The C is for Cucumber!

  • pezpunk (unregistered) in reply to RFoxmich

    when I was programming in WebFOCUS, I asked why their example code all had 7-character all-caps method names like "STDFTDS()" instead of "StandardFunctionToDoSomething()". their response was that although FOCUS allowed method names longer than 7 characters, function names of 7 characters or fewer "worked better".

    This led me to wonder if the inverse relationship between function name length and reliability meant that single-character function names would work ALL the time (gasp) .. alas, this was not the case.

  • (cs) in reply to Zacrath
    Zacrath:
    I've never seen such a heated argument in the comments before. Although it's the same two posts over and over and over so I don't think it counts.
    You don't remember the classic embedded systems without filesystem comments section?

    Addendum (2013-11-21 11:30): Linked to the second page of the seconds by accident. The same heated argument over and over starts on the first page, comment number 2 (but only because there is no frist!).

  • (cs) in reply to quis
    quis:
    Could it be? The first time the editor of the article is as bat-shit clueless as the submitter of the alleged WTF?

    Hanzo would be a welcome improvement over this stinking pile of article.

    I disagree! At least there's an actual WTF and it is described correctly by the author: A model object is missing!

    Also the article is short and nothing is embellished.

    Hanzo stories are long and boring!

  • Anon (unregistered)

    Looks pretty par for the course with objective-C. I just finished an app using Xamarin and C# but couldn't completely avoid a unpleasant dip into Objective-C for some third party libraries. And of course, the free third party libraries all worked fine and the one we actually paid for is a total fustercluck.

    Also annoying, Apples habit of having methods (or messages) with name like "ViewDidAppear" rather than the more terse but perfectly understandable "ViewAppeared". There's a whole bunch of "xDidy" and "yWillx"

  • Anon (unregistered) in reply to Anon

    Not to mention the lack of namespaces which leads to bullshit like "NSString" and "CAAnimation"

  • Anon (unregistered) in reply to foxyshadis
    foxyshadis:
    quis:
    Could it be? The first time the editor of the article is as bat-shit clueless as the submitter of the alleged WTF?

    Hanzo would be a welcome improvement over this stinking pile of article.

    ObjC programmers are as full of Stockholm Syndrome as VBScript gurus: Once you get used to being abused you start to think it's OK, then that it's the one true way.

    Even in C++, the only time this would be remotely reasonable is a constructor that takes dozens of possible arguments. Anything else, you either set properties or break up your 1000-line omnifunction, you don't defend it.

    Stockholm Syndrome.

    /The Crying Game?

    QFT.

    You don't have to get far into Objective-C before you run, shockingly and unexpectedly into it's massive cock.

  • nitePhyyre (unregistered) in reply to Jellineck
    Jellineck:
    ANON:
    Ok, and I always thought VB is weird.

    Makes me hope that Android will prevail, I don't want to learn this language.

    I'm working on a iPad application right now written in beautiful C#. No ObjC for this guy. Thanks, Xamarin.

    Wow, thanks, for pointing out Xamarin!

  • Anon (unregistered) in reply to nitePhyyre
    nitePhyyre:
    Jellineck:
    ANON:
    Ok, and I always thought VB is weird.

    Makes me hope that Android will prevail, I don't want to learn this language.

    I'm working on a iPad application right now written in beautiful C#. No ObjC for this guy. Thanks, Xamarin.

    Wow, thanks, for pointing out Xamarin!

    Honestly, having used Xamarin, it's got some seriously rough edges that will make you pull your hair out. If you are working on an app, and it needs to be cross-platform, I would seriously look at HTML 5 / JS / PhoneGap before dropping major $$$ on Xamarin.

    If you are using Xamarin, check out MVVMCross. It's the bomb.

  • sunnyboy (unregistered) in reply to RFoxmich

    UCWLSID

    <old fart mode on> Exactly. Any programmer who needs more is just a poser. REAL PROGRAMMERS WOULD ONLY NEED 3-LETTER SUBROUTINE NAMES!!! <old fard mode off>

    :-D

  • (cs) in reply to QJo
    QJo:
    Think yourselves lucky you doing have to program in FORTRAN 4 in which you're limited to 6 character identifiers, uppercase only and the arithmetic IF.
    I remember some commercial Unixes were still truncating symbol names at 6 characters (well, 7 including the leading “_”) when I started at university. This was blamed for some of the horrible terseness in the C standard library, and the catastrophic nastiness in the NAG library as well (where, back when I started, you used it by looking up the function you wanted in the ring binder manual and using the symbol code it described there; you could not guess the naming scheme due to its use of mixed random letters and numbers…)
  • (cs) in reply to QJo
    QJo:
    Disgraceful. 8 character subroutine names was good enough for we engineers programming in FORTRAN 77 on the VAX, it's good enough for you pesky kids. Think yourselves lucky you doing have to program in FORTRAN 4 in which you're limited to 6 character identifiers, uppercase only and the arithmetic IF.

    Bah. You kids of today, don't understand the first thing about programming. GOML.

    Fortran II was the one that had ONLY the arithmetic IF. Thankfully Fortran IV (later renamed to Fortran 66) did have logical IFs.

    Of course if you were on the IBM 1130, you only had 5 character names, and only the arithmetic IF, but you DID have data statements.

    One could go back further to Fortran with Format (there was a version without!) that didn't even HAVE subroutines.

    The luxuries we have today. Gigabytes of ram, Terabytes of disk. Notch those down by a factor of 100k and try to do things! It humbles you REAL QUICK.

    Every programmer should have to do work on an ASR33 teletype as part of an apprenticeship. It transforms you in many ways.

  • gnasher729 (unregistered) in reply to Anon
    Anon:
    Not to mention the lack of namespaces which leads to bullshit like "NSString" and "CAAnimation"
    You just demonstrated that it has namespaces :-)

    One is in the "NS" namespace, and the other in the "CA" namespace.

Leave a comment on “A Method Gone Too Far”

Log In or post as a guest

Replying to comment #:

« Return to Article