• NULLPTR (unregistered)

    nullptr=>nullptr.Address!=null;

  • bvs23bkv33 (unregistered)

    real wth they have chosen c# over cobol

  • CHristian (unregistered)

    Also, why the fuck do they all the copying manually?! Automapper exits for a reason.

  • (nodebb)

    The code sample at the beginning contains another subtlety...

    It fetches (or not) the information into a long? called acctId (note small "d") and passes a something called acctID (note big "D") to a function expecting an int?.

    It would be interesting to see where acctId ends up being used.

  • Robert (unregistered) in reply to Steve_The_Cynic

    Nice observation.

    If you are right and those two variable names are two different things, than there is about no connection of the 2 snippets. wtf.

    If this was just a typo and it was meant to be the same variable, than this would result in a compile error beccause long? cannot be passed into an int? parameter. WTF!!!

  • (nodebb)

    I see the whole "don't do anything just log an error and reload the page" approach at work constantly. like I get not showing an error page, but give some indicator that something failed. Otherwise what happens is the page (often some Ajaxy thing) just "finishes" but nothing changes. No indication there was an error because the error got logged in the stored procedure which takes/gives output variables to indicate it's status but the page doesn't do anything if the output variable indicates an error.

  • Hanneman (unregistered)

    I have never likes case sensitve languages. Case preservation is a good thing. You can not per accident create two different variables with a small lexical distance like acctId and acctID

    Would amsterdam or Amsterdam be two different places?

  • MiserableOldGit (unregistered)

    Looks like this concept of a parent account was retrofitted to existing code ... in a really cack-handed way. Someone being lazy about rewriting stuff properly and making more work for themselves (and everyone else).

  • (nodebb)

    Remember, none of this would've happened had Bill Gates' parents not met.

  • (nodebb) in reply to Hanneman

    "Would amsterdam or Amsterdam be two different places?" - There are at least 512 different ones :)

  • (nodebb) in reply to Robert

    I get the sneaky suspicion that acctID is actually a global int variable, used somewhere else entirely, for a completely different purpose, but still visible here. When the compiler gets to the typo, it links to the global variable instead of the local variable acctId and then some developer is left wondering why the wrong value is being passed to the function as they walk through the execution one step at a time in the debugger.

  • (nodebb) in reply to Nutster

    there's actually two account IDs: acctId (lowercase D), which is the name of the variable in the calling code, and acctID (uppercase D), which is the name of the parameter to the called function, both of which live in entirely separate scopes. There's still the issue of the value sometimes being an int? and sometimes being a long? though.

    Addendum 2020-02-13 09:21: With the former only being used in the first block of code (the caller), and the latter only being used in the second block of code (the callee).

  • (nodebb) in reply to Hanneman

    Would amsterdam or Amsterdam be two different places?

    Is ß the same as SS? Lexical equivalency is weird enough that I'd rather my compiler simply treat my variable names as a series of characters to be compared literally than have it do "fuzzy matching".

    It's not the compiler's job to fix our sloppiness. However, I'm all for editors that identify these problems and help fix them. Visual Studio is pretty good at doing this.

  • P.B. Floyd (unregistered) in reply to CHristian

    I'm not a developer, but I've heard at my place of business that Automapper is "usually more trouble than it's worth."

  • (nodebb) in reply to P.B. Floyd

    I've used Automapper in the past - the primary struggle we encountered with it was that it defaults to mapping properties based on exact name match. Which works great until you need to rename your properties for some reason and forget that you need to rename both.

    There are mapper validations meant to be used especially in unit tests but that doesn't solve the problem outright, just moves it closer to compile time so you're failing your build instead of failing at QA time.

    We ended up still using Automapper for the API but manually specifying every property mapping even if the property names were identical.

  • MB (unregistered)

    Case-insensitivity is language-specific. For example, there's the "Turkic I" problem: when Turkey switched to using the Latin alphabet for Turkish, it split I/i into dotless I/ı and dotted İ/i, so that while most languages that used the Latin alphabet would say that 'I'=='i', Turkish (and Azerbaijani), would say that 'I'=='ı' and 'İ'=='i', and 'I'!='i'.

  • MiserableOldGit (unregistered)
    For example, there's the "Turkic I" problem

    Oh the fun that only a few of us have had with that one!

    and 'I'!='i'

    Just for emphasis as that's where the pain is! Good explanation though, I always (naively) though it was an encoding error that had become embedded to deep to fix, I see what has happened now.

  • Hanneman (unregistered) in reply to TheCPUWizard
    Comment held for moderation.
  • Barf4Eva (unregistered)

    mmmm, yummy... Manual hydration from EF to view models... What I wouldn't give to look at thousands of such lines of mindless code...

  • 🤷 (unregistered)

    There's no problem here, as right now the code wouldn't compile. We pass a long? into a method that expects an int?. This doesn't work. Unless of course the method is overloaded and both methods are equally fucked up. The apparent typo mentioned in the previous comments seems to have been fixed, though.

  • Anonymous (unregistered)
    Comment held for moderation.
  • Old Timer (unregistered) in reply to Jaime
    Comment held for moderation.
  • (nodebb) in reply to Hanneman
    Comment held for moderation.
  • M (unregistered)
    Comment held for moderation.

Leave a comment on “The Powerful Parent”

Log In or post as a guest

Replying to comment #:

« Return to Article