• Hanzito (unregistered)

    I am a good developer. I know what I'm doing. I don't have to declare variables.

  • m (unregistered)

    $frist = $friSt;

  • RLB (unregistered)

    The variable name $lastname makes me think this could've been written by my ex-colleagues. They had apparently never heard of middle names, let alone the word "surname".

  • (nodebb)

    I'll admit I have an ugly related pattern throughout my Python code....

    def __init__(self, frist, secnod):
        self.frist = frist
        self.secnod = secnod
    # # more constructor stuff
    
  • wiseguy (unregistered)
    Comment held for moderation.
  • Mark (unregistered)
    Comment held for moderation.
  • (nodebb)

    I'm going to guess that User was originally a struct with public fields for name, lastname, etc... Then during some code review there was a comment about data encapsulation and the dev tried to implement it and forgot about the assignments or didn't understand the difference. The User struct had a lastname field but the function takes lastName. Or possibly the fields WERE private and they couldn't get the assignments to work and removed the user-> part to make it compile or run.

  • (nodebb)

    "I took a programming class in high school...."

    If the machine running this code has a lot of memory, it would be a total waste of resources to not create duplicate and triplicate objects to use all the memory at once, no?

  • (nodebb) in reply to sibtrag

    Shame that with all that effort, you were frouth...

  • matt (unregistered)
    Comment held for moderation.
  • MRAB (unregistered) in reply to RLB
    Comment held for moderation.
  • Graculus (unregistered) in reply to RLB

    They probably won't have heard of "surname" unless they are British as "Lastname" is American-English so more common. Really it should be FamilyName anyway as not all languages order the name such that the "lastname" is the family name

  • Dot (unregistered)
    Comment held for moderation.
  • airdrik (unregistered) in reply to m
    Comment held for moderation.
  • Loren Pechtel (unregistered)

    I've seen programming books that weren't too different than this.

    Constructors setting class fields to incoming parameters that differ only in capitalization. I have always considered it atrocious. Case sensitive names, on the fly declaration, very much a footgun.

  • mihi (unregistered) in reply to Graculus
    Comment held for moderation.
  • (nodebb) in reply to Graculus

    Really it should be FamilyName anyway as not all languages order the name such that the "lastname" is the family name

    Um. No. In some cultures (it's cultural rather than linguistic), none of the names are family names. Consider Icelanders, where what looks like a surname is, in fact, derived from the name of the person's actual father(1)(2). If Rogni is the son of Magnus, then his full name is Rogni Magnusson. If he names his son "Olaf", that son (Magnus's grandson) is Olaf Rognisson.

    (1) As opposed to "patronymic" surnames in modern English-speaking countries (Stephenson, Richardson, etc.), where the Stephen, Richard or whatever was a denizen of probably 11th or 12th Century England, and certainly not the current person's father.

    (2) Or mother, in relatively rare cases where the father isn't (officially) known.

Leave a comment on “The Last Last Name”

Log In or post as a guest

Replying to comment #681947:

« Return to Article