• mjolnir (unregistered)

    The mind boggles.

    I keep reading about contractors being paid in full for garbage like this. How can I get one of these gigs? My clients all expect GOOD code that actually WORKS.

  • me (unregistered)

    is that it?

  • (cs)

    Great, all he did was change the text for the email extension. I hope they didn't sell the word "supports" too much because in their case it means "it might work one day, but not quite yet"

  • (cs)

    I can see three WTFs. Please correct me if I'm wrong:

    1. Handling the differet cellphone providers with an enumeration instead of using something more dynamically (or rather runtime-) configurable requires rebuilding the app when providers are added or vanish or when the name of their SMS handling server changes.

    2. Moving from DNS names to IP addressing is most certainly not an improvement.

    3. The "goto Label_005B" is particularly amusing. What weed was this guy smoking?

    What did I forget?

  • (cs)

    Ok, sooo how will this even work? All smtp uses email's domain to understad where it's send to ... if you just put the ip of the mail server it would:

    1. Not work due to not finding corresponding mail server
    2. In case I missed the part of SMTP 101 where it's possible to relay to an IP ... how would the receiving server know where to host it into?

    I too want one of this contracts ... being able to make whatever I like not worring about it working and being paid so much...

  • foo (unregistered)

    I only wish I could get paid buckets of money for code like this. The biggest WTF in the world is that anyone manages to get a pay check for a steaming pile that looks anything remotely like this.

  • (cs)

    What is this "goto" he speaks of? That looks handy. I think I will start using it... EVERY WHERE!

  • Rik (unregistered)

    Umm guys. SMS means Short Message Service and is called "texting" in most countries.

  • (cs) in reply to Rik

    TEXT IS NOT A VERB!

  • TGV (unregistered) in reply to Rik

    Most countries being England and the US? Here it's called smsen...

  • TGV (unregistered) in reply to Welbog
    Welbog:
    TEXT IS NOT A VERB!
    Verbing weirds language.
  • (cs) in reply to Rik
    Rik:
    Umm guys. SMS means Short Message Service and is called "texting" in most countries.
    I think I speak for everyone when I say this is totally new information!
  • TGV (unregistered) in reply to Welbog
    Welbog:
    TEXT IS NOT A VERB!
    You're absolutely right. Verbing weirds language.
  • Charles (unregistered)

    I work on an SMSC, my guess is the WTF here is that he didn't interface using SMPP, the industry standard for sending short messages like grown-ups.

  • (cs) in reply to Rik
    Rik:
    Umm guys. SMS means Short Message Service and is called "texting" in most countries.

    Whoa, whoa, let's see a reference for that.

  • (cs) in reply to Charles
    Charles:
    I work on an SMSC, my guess is the WTF here is that he didn't interface using SMPP, the industry standard for sending short messages like grown-ups.

    SMPP. Teehee you said PP. You should start sending your messages like a grown up.

  • Anon (unregistered) in reply to TheRider
    TheRider:
    3. The "goto Label_005B" is particularly amusing. What weed was this guy smoking?

    Since the code was decompiled (not the original source code), is it possible that the decompiler added the goto? Or rather the original compiler translated break into goto (but didn't for the last one)?

  • Spoe (unregistered) in reply to Welbog
    Welbog:
    TEXT IS NOT A VERB!

    Yes, and when William the Conqueror showed up on the shores of Britain in 1066 he found everyone speaking the same English we do today. Since, you know, the language never changes and words never take on new meanings and/or usages. Never.

    CAPTCHA: craaazy

  • Frostcat (unregistered) in reply to Anon
    Anon:
    TheRider:
    3. The "goto Label_005B" is particularly amusing. What weed was this guy smoking?

    Since the code was decompiled (not the original source code), is it possible that the decompiler added the goto? Or rather the original compiler translated break into goto (but didn't for the last one)?

    the label name is obviously generated by a decompiler. It didn't add any gotos, that's how switches wind up being compiled. You can see it yourself: write some code in java or a .net language, then use javap or ildasm.

  • The Anonymous Coward (unregistered) in reply to Maximilianop

    All smtp uses email's domain to understad where it's send to ... if you just put the ip of the mail server it would:

    1. Not work due to not finding corresponding mail server
    2. In case I missed the part of SMTP 101 where it's possible to relay to an IP ... how would the receiving server know where to host it into?

    Soooo... you don't actually know what an IP is, do you? When a mail server (or anything else) uses a domain name to route traffic, it does so by first using DNS to translate that name into an IP; the IP address is what's actually used to figure out where traffic should go. Domain names are just to assist humans.

  • dnm (unregistered)

    Maximilianop: You can e-mail an IP address just fine. When you send an e-mail, it will try to get its mx record, if one does not exist, it will go to its A record. Or in the case of an IP address, straight to the IP and attempt the delivery.

    The way this guy is doing it is not optimal, but if there is a mailserver on that IP and it has a default domain, it'll likely be delivered.

  • Verbal Kint (unregistered) in reply to Welbog

    TEXT IS NOT A VERB!

    But more imporantly, GetEmailBasedOnCarrier IS a verb phrase, and yet the dickhead has a class called GetEmailBasedOnCarrier.

    objects == nouns methods == verbs

    (Yeah, I know, there are sensible exceptions to this rule, and I've written some of them myself).

  • WTFer (unregistered)

    Umm howcome everybody so far missed the wtf of the return type being object for a method that only returns a string value? Returning an object when you know the type of your return is retarded since you'd have to cast it as a string to use it (unless you are working in a non-typesafe language) Actually I think in C# this would fail to compile, I think it would need to read

    return ((object)(this.PhoneNumber + "@" + text1));
    

    to compile.

  • Jimmy (unregistered) in reply to Anon

    Yeah, that can happen. This looks like IL to C# using Reflector. The original code probably looked something like this:

    private object GetEmailBasedOnCarrier()
    {
        string domain = null; 
        switch (this.MobileCarrier)
        {
            case SMS.EnumMobileCarrier.T_Mobile: 
                domain = "tmomail.net";
                break;
            case SMS.EnumMobileCarrier.Virgin_Mobile: 
                domain = "vmobl.com";
                break;
            case SMS.EnumMobileCarrier.Cingular: 
                domain = "cingularme.net";
                break;
            case SMS.EnumMobileCarrier.Sprint: 
                domain = "messaging.sprintpcs.com";
                break;
            case SMS.EnumMobileCarrier.Verizon: 
                domain = "vtext.com";
                break;
            case SMS.EnumMobileCarrier.Nextel: 
                domain = "messaging.nextel.com"; 
                break;
        }
        return (this.PhoneNumber + "@" + domain);
    }
    

    The text1 name comes from the compiler also, which does not preserve names of local variables.

  • BBT (unregistered) in reply to Welbog
    Welbog:
    TEXT IS NOT A VERB!

    It is now. Language changes- deal with it.

  • J (unregistered) in reply to WTFer

    Their code compiles. In .NET, every class implicitly derives from object.

  • dkf (unregistered) in reply to Maximilianop
    Maximilianop:
    Ok, sooo how will this even work? All smtp uses email's domain to understad where it's send to ... if you just put the ip of the mail server it would:
    1. Not work due to not finding corresponding mail server
    As long as the IP address is right, there's a strong chance that it will go to the right place. Of course, that's a massive proviso as it depends on these providers never ever changing their SMTP/SMS gateway machines' IP addresses.
    2. In case I missed the part of SMTP 101 where it's possible to relay to an IP ... how would the receiving server know where to host it into?
    Provided it's to a mailbox that is "local" to the receiving server, it will work. But is the gateway able to do the translation to SMS itself or does it go onward by SMTP internally first? Who knows, but if it is the second, delivering to IP will almost certainly break massively anyway...
  • (cs) in reply to Charles
    Charles:
    I work on an SMSC, my guess is the WTF here is that he didn't interface using SMPP, the industry standard for sending short messages like grown-ups.

    My guess is the company didn't want to pay to send text messages.

    This way the company can send all the text messages they want with out paying a dime. I know it's not the best way, but I'm guessing this was their line of thought. I had to deal with a situation exactly like this before.

  • PS (unregistered) in reply to Welbog
    Welbog:
    TEXT IS NOT A VERB!

    Can you please not text in upper case, thanks!

  • (cs)

    All right, lets say this program is put into production and then the primary dies for good and a backup (if they have one) becomes active. Now the ipaddress might be different... oops got to recompile the code :)

  • (cs) in reply to Jimmy
    Jimmy:
    Yeah, that can happen. This looks like IL to C# using Reflector. The original code probably looked something like this:
    private object GetEmailBasedOnCarrier()
    {
        string domain = null; 
        switch (this.MobileCarrier)
        {
            [..snap..]
    
        case SMS.EnumMobileCarrier.Nextel: 
            domain = "messaging.nextel.com"; 
            break;
    }
    return (this.PhoneNumber + "@" + domain);
    

    }

    The text1 name comes from the compiler also, which does not preserve names of local variables.

    Love to see something getting routed to: [some number]@null

    guess making a default-throw thing is something for even better paid people ;)

  • Rik (unregistered) in reply to zip
    zip:
    Rik:
    Umm guys. SMS means Short Message Service and is called "texting" in most countries.

    Whoa, whoa, let's see a reference for that.

    http://en.wikipedia.org/wiki/Short_message_service

  • Pawel (unregistered)

    This CodeSOD is lame.

    @Derrick: Please never use decompiled code as a reference for cs skills ever again. :)

    captcha: pointer

  • SuperJason (unregistered)

    I'm not sure if I should feel stupid about this or not.

    I wanted to have a service that did the same thing, and I was going to use the email gateways as well. Is there any reason why that is a bad idea?

    Do they cut you off for overuse? Any idea what kind of threshold there would be?

    It's a super-simple solution to a problem that can get really complicated. Do I want to deal with SMPP and pay a fee for every message? Heck no.

  • (cs)

    @TGV: Oh, as in smsen wesson? We 'Murricans know that name very well.

    @Spoe: What, never?

    @Verbal Kint: It's a method, not a class.

    @Pawel: Any programmer should have realized that the carriers should be configgable. The non-code WTF is much bigger, though (the substitution of IP addies, making it much more fragile). On the other claw, maybe the contractor was just setting himself up for more work later, when the app needed "updating"....

    @SuperJason: The guy who initially implemented a web-based email/SMS distribution system I once worked on, apparently didn't think it was a bad idea, nor did I, nor our boss. However, the carriers were configgable, including via the web interface (if you were logged in as an admin). The hardcoding is the initial "real WTF", followed by the bigger-WTF of the "ip calls".

  • Jimmy (unregistered) in reply to i1emming
    i1emming:
    Jimmy:
    Yeah, that can happen. This looks like IL to C# using Reflector. The original code probably looked something like this:
    private object GetEmailBasedOnCarrier()
    {
        string domain = null; 
        switch (this.MobileCarrier)
        {
            [..snap..]
    
            case SMS.EnumMobileCarrier.Nextel: 
                domain = "messaging.nextel.com"; 
                break;
        }
        return (this.PhoneNumber + "@" + domain);
    }
    

    The text1 name comes from the compiler also, which does not preserve names of local variables.

    Love to see something getting routed to: [some number]@null

    guess making a default-throw thing is something for even better paid people ;)

    Yeah, that was an example of the original code, not my code, though I love making all my functions return "object". Looks like I made a change to make Resharper shut up. I hearby vow not to introduce any more Resharper fixes :). Wait, why am I defending code I posted in a forum...

  • snoofle (unregistered) in reply to Welbog
    Welbog:
    TEXT IS NOT A VERB!
    Maybe, but VERB is most definitely a NOUN, unless it's being used as a verb:

    I verb'd (a noun) you verb s/he verbs we verb you verb they verb

  • (cs) in reply to bstorer

    if you can send these "text messages" on a cell phone, where do you plug in the damn keyboard? This seems dumb, I don't want to carry around my fully functional keyboard in my pocket when i want to send a "text message". I'll stick to carrier pigeons and telegraphs!!!!

    </SARCASM>
  • Jimmy (unregistered) in reply to Rik
    Rik:
    zip:
    Rik:
    Umm guys. SMS means Short Message Service and is called "texting" in most countries.

    Whoa, whoa, let's see a reference for that.

    http://en.wikipedia.org/wiki/Short_message_service

    http://en.wikipedia.org/wiki/Wikipedia:Credibility

  • Pawel (unregistered) in reply to DaveAronson
    DaveAronson:
    @Pawel: Any programmer should have realized that the carriers should be configgable. The non-code WTF is much bigger, though (the substitution of IP addies, making it much more fragile). On the other claw, maybe the contractor was just setting himself up for more work later, when the app needed "updating"....
    The contractor itself called the application a "demo" which Jared decompiled. With the given information we can not say, if it is not configurable in the full version. What is the wtf in making a non-configurable demo for a customer, if you do not know, if he will give you money to develop it further?
  • (cs) in reply to Rik
    Rik:
    Umm guys. SMS means Short Message Service and is called "texting" in most countries.

    Bwauahuhauha. Here it's called either mensagem de texto or torpedo.

  • frymaster (unregistered) in reply to TGV
    TGV:
    Most countries being England and the US? Here it's called smsen...

    I live in Scotland and it's the same here... I believe it's also the same in Wales, Northern Ireland, the Republic of Ireland, Australia, New Zealand and sometimes in India :P

  • (cs)

    question for pondering: considering how similar (in function) pagers and sms are, how come they can't communicate with each other via some intermediate? Obviously a pager and a cell phone operate on different frequencies and protocols, but how come there's not a phone number you can SMS and it'll send a page, and vice versa?

  • (cs) in reply to PS
    PS:
    Welbog:
    TEXT IS NOT A VERB!

    Can you please not text in upper case, thanks!

    Me thinks he texted it with a mobile phone brick. You know, those big ones that didn't understand lower case in SMS.

  • Misha (unregistered) in reply to morry
    morry:
    question for pondering: considering how similar (in function) pagers and sms are, how come they can't communicate with each other via some intermediate? Obviously a pager and a cell phone operate on different frequencies and protocols, but how come there's not a phone number you can SMS and it'll send a page, and vice versa?

    They can't? I always assumed pagers where just mobile phones without the voice function. But then, having grown up in the mobile age, I've only ever seen a pager on /Scrubs/. I don't think pagers are used at all in Europe/Asia where SMS is ubiquitous, except maybe by emergency workers.

    So how does a pager work if it isn't a phone? Are you telling me we have an entire wireless network just to support something no one uses anymore?

  • Nelle (unregistered) in reply to Pawel
    Pawel:
    The contractor itself called the application a "demo" which Jared decompiled. [...]

    Quite my point ... Since when did this site started featuring non-production code ?

    I am sure everyone here had written at least one demo app that wasn't configurable but hardcoded ...

  • (cs) in reply to Nelle
    Nelle:
    Quite my point ... Since when did this site started featuring non-production code ?
    Maybe you missed the last paragraph?
  • (cs) in reply to Jimmy
    Jimmy:
    Yeah, that was an example of the original code, not my code, though I love making all my functions return "object". Looks like I made a change to make Resharper shut up. I hearby vow not to introduce any more Resharper fixes :). Wait, why am I defending code I posted in a forum...
    I'm sorry, the remark on the 'better paid' was not ment for you, but for the orginal coder. I figured you posted the code the orginal coder writen, not you :)
  • -j (unregistered) in reply to BBT

    fnubish ba ba toobish! Yukenbooo.

  • -j (unregistered) in reply to BBT
    BBT:
    Welbog:
    TEXT IS NOT A VERB!

    It is now. Language changes- deal with it.

    The witty riposte of illiterates down the centuries!

Leave a comment on “Buzz, Cell Phone, Buzz”

Log In or post as a guest

Replying to comment #134848:

« Return to Article