• (nodebb)

    Last time I was this early, accessing a readonly property blasted a patient with 25,000 rads of X rays.

  • LCrawford (unregistered) in reply to Mr. TA

    The early bird gets the rads!

  • MiserableOldGit (unregistered)

    I don't think that would raise an unhandled exception on windows, I think it would fire up that annoying wizard about setting up a mail client. Or your local anti-malware stuff will start screaming at you about one program trying to start another and do you give permission, etc, etc.

    Mind you, there's still the possibility of an unhandled exception, which will trap you in endlessly recursive errors.

    Either way, still an annoying WTF. Not sure what it, specifically, has to do with offshoring though, just looks like a newbie error, worked nicely on his machine and looked kewl.

    If I wrote something like that, I too would sign it "License Person CompanyName".

  • 516052 (unregistered)

    What's wrong with Enviroment.Newline? Beats adding line breaks manually and having to worry how they come out. And it looks neeter as well.

  • (nodebb)

    What does Process.start return? The error message the poor user gets must be quite interesting. If they get it before the mail program has started and grabbed you input that is.

  • Jaloopa (partially registered) (unregistered) in reply to thosrtanner

    It returns a Process object, but it seems that when appended to a string it's implicitly ToString()ed

    var x = "test" + Process.Start("mailto:[email protected]");

    gives the output testSystem.Diagnostics.Process (OUTLOOK)

  • ttlanhil (unregistered)

    That's not why offshore code has a bad rep. It's how, but not why. The why is that management are trying to find cheaper developers (or cheaper development, rather) - and the more they focus on price, the lower quality will be. Fast, Cheap, Good: You can't have more than 2 (you can, however, have less, even 0 - e.g. those managers)

  • 🤷 (unregistered)

    There's nothing wrong with Environment.NewLine. Saves you the trouble to decide between \r, \n and \r\n (hopefully those show up correctly in the comment. TRWTF is not having a preview function!)

    Anyway, "License Person CompanyName". What's that? The Person, woman, man, camera, TV of the offshore team? I'm afraid to tell them the bad news, they just failed the MCI test.

  • Best Of 2021 (unregistered)

    Pay peanuts, get monkeys. That's well known in terms of buying services or trying to hire people locally, but somehow managers convince themselves that it's not true when outsourcing.

    The contractor will have been paid for completing the project based on certain acceptance criteria, and that's all the offshore team will care about. They don't care about your users, or your UX, or reasonable behaviour. And, also, because you pay low prices for them, they won't even be good at completing the defined objectives in a good way.

    There are some professional outsourcing companies where the cost saving comes from cost of living differences between countries - typically based in eastern Europe for our European market, and I believe Central or South America for the US/CA market. Even there, you have some problems, but at least their coders are well qualified and competent.

  • Robin (unregistered)

    I'm not a C# person, but I'm surprised this even compiles - I would expect Process.Start to return nothing (ie void) so why are you allowed to concatenate it to a string?

    Even assuming this works, and for some reason you've decided that opening an email client inside a getter is what you want to do, from a coding style point of view I would prefer to execute the side effect in a separate line, before separately returning the actual error string - rather than "hiding" the side effect inside the returned expression.

    (Indeed, not being familiar with C#, on first scanning this code I assumed Process.start must be simply some kind of string formatting utility, precisely because of how it is used here.)

    Granted this is minor compared to the WTF of doing this at all, but it would still annoy me a perhaps irrational amount. (I admit to being much more comfortable with functional programming than OO, so I probably obsess more than most about side effects being cleanly separated from calculations/logic.)

  • boss nass (unregistered)

    eh - whatever.

  • 🤷 (unregistered) in reply to Robin

    I would expect Process.Start to return nothing (ie void) so why are you allowed to concatenate it to a string?

    Process.Start("myProgram"); returns a System.Diagnostic.Process object. Concatenated to a string, it appears like this, for example: "This is fun: System.Diagnostics.Process (notepad++)"

  • Anonymous') OR 1=1; DROP TABLE wtf; -- (unregistered)

    Zawinsky's Law: Every program attempts to expand until it can read mail.

    This program just got there a lot faster than most.

    (I know, I know, this is sending mail, not reading it, and it's relying on an external program. Work with me here!)

  • Richard Brantley (unregistered)

    About 75-80% of my current job involves doing penance for the sins of my predecessors - an army of offshore programmers who were hired by non-technical management and who worked with no adult supervision. There are so many code smells our Git repos should be declared SuperFund sites. (Not that the offshore team bothered using source control; they just patched live code in production a lot.)

    Their typical methodology appears to be to throw things at the wall until something stuck, and then ship that - and no bother cleaning up the dead ends and failed experiments along the way. If it worked, it shipped. If it happened to work correctly, even better.

  • Jim Jam (unregistered)

    Hehe, if one day this code got reused in a web server or a windows service it will be even more dreadfull - to have thousands of draft emails created unnoticed, slowly killing the server performance.

  • Gummy Gus (unregistered)

    I don't know why fingers are getting pointed at an offshore team. They can work really hard.

    At one medical device firm, we had offshore testers of our blood oxygen level sensors. One test specified that it had to be run for 72 sequential hours on one machine.

    They often returned the test results within a day. No lie.

  • Dave (unregistered)

    Outsourcing is not an example of the principal-agent problem. It's contracted for by people who are.

  • Carl Witthoft (google)

    IMHO the only acceptable "connections" to email from a web page are these 2:

    1. provide the email address as a standalone link, so if I click it , it goes to my current default email app.
    2. a dialog box where I type/paste,/attach everything, click "send" and the web page passes everything to the Home server which either emails or emulates emailing to the destination.
  • (nodebb)

    I have an extension method called NewLine that inserts an Environment.NewLine

  • Loren Pechtel (unregistered)

    Strangely, I don't think this is quite as horrible as many think. Note that this error is about licensing issues--and it's trying to set up an e-mail to who you should contact about your lack of a license. This is being idiot-friendly and might even catch some pirates (worker doesn't know the boss is using pirated software.)

    The concatenation is stupid, though. For those who don't speak C#--I believe everything implements the method ToString() and thus will compile if asked to be a string. The default implementation of ToString() simply returns the name of the type of the object, though. Numeric types return a number, strings return the string and anything else you can override the ToString() method to produce more sane output. (Note that this can be very useful for debugging--that's the value that will show when you look at the class in the debugger.)

  • 516052 (unregistered)

    That is true and it isn't. Basically in C# all classes inherit Object by default and Object has a ToString method. But there is no guarantee that they will override it meaningfully. In this case it will and the docs say it returns "Formats the process's name as a string, combined with the parent component type, if applicable." But it's not something you can rely on, especially not for functions not from the framework.

  • (nodebb) in reply to Anonymous') OR 1=1; DROP TABLE wtf; --

    "There's always one thing you can do from inside a computer. Even if you're a jumped-up little subroutine you can do it. You can always email. —The Doctor

  • Robin (unregistered) in reply to Loren Pechtel

    Not sure if you're being serious or not, but just in case:

    Sure, it may well make sense for the application to try to send an email when the user doesn't have a license. But then you write a method that specifically does that, and gets called at the appropriate time.

    There is no excuse for putting this inside a getter, even one for a property called ErrorMsg. Ever heard of a thing called "separation of concerns"? If I'm a developer working on this code, I shouldn't have to worry that accessing a string property, which I might want to do anywhere for any reason, might accidentally start causing the program to actually "do something".

  • 516052 (unregistered) in reply to Robin

    Ah you young people and your separation of concerns and no sideeffects and minimum surprise principal and all those. You're no fun. Why I bet you wouldn't even like it if I did this.

    call _some_sub

    push _address_of_other_sub


  • (nodebb) in reply to Gummy Gus

    Results of a 72-hour test within 24 hours? They are good

  • (nodebb) in reply to Loren Pechtel

    The biggest WTF is that it is being done inside a property getter. A getter should do no more than get the property. Any time anybody tries to use the value of the property, the app will try to create a new email. This is not good.

  • BernieTheBernie (unregistered)

    Oh, nobody has found out yet that this code is expected to run in a Windows Service, or a Web Server?

  • 516052 (unregistered) in reply to Jeremy Pereira

    There are definitively good situations when you want to do stuff in the getter. It's not always just a passthrough. But boy you are right when you say this ain't one of those.

Leave a comment on “Shorely a Bad Choice”

Log In or post as a guest

Replying to comment #:

« Return to Article