• 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)

    It propably does not help that PHP is partly case-sensitive: variables are, constants usually are, classes, namespaces, methods, functions are not...

  • Mark (unregistered)

    I can almost see the logic if the programmer thought (for some wild reason) that there was an issue of scope between parameters and local variables.

    Like, if $username was passed as a parameter, then it came from outside the function, and needed to be assigned to a local variable that would be native only to the internal code of the function. So the parameter $username had to be assigned to a local variable, which... for convenience, is also c-called, um, $username....

  • (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)

    Why does the word code jump between being it (the correct singular) and they SEVERAL times? Is it because Remy couldn't copy edit his way out of a wet paper bag?

  • MRAB (unregistered) in reply to RLB

    Calling it a "last name" wouldn't work for, say, Koreans, because they put the surname first.

  • 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)

    Variable names in PHP is case-insensitive. $lastname and $lastName is the same thing.

  • airdrik (unregistered) in reply to m

    I tried removing that comment, since it wasn't frist. But then the image rendering module broke.

  • 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

    Either you should use first name and last name (and middle etc. if you want to support more than two)

    Or you should use given name and surname (but don't assume which one is first and which is last)

    Mixing from both is a good way for desaster.

    And when you have read https www.kalzumeus.com 2010/06/17/falsehoods-programmers-believe-about-names/ you know that actually you should just provide one "Full name" field and all problems are solved :)

  • (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.

  • Patrick (unregistered)

    I think capitalization is highly overrated. Maybe its because I work in a language that is capitalization-agnostic, but for the life of me I cannot understand why I would want to have multiple versions of a variable name, all different capitalized. LastName != lastName != lastname. I am convinced that it gives more problems in misreading and mistyping than it solves in. Well, what does it solve actually?

    And on the subject of names: if you are a programmer and have not yet read this, then stop whatever you're doing and read it. Now! I mean it. Not life-saving, but definitely life-changing https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/

  • RLB (unregistered) in reply to Graculus

    We're Dutch. We learn English in school, and by default British English; but it's true that many of us gravitate to Americanisms later in life due to trash telly.

Leave a comment on “The Last Last Name”

Log In or post as a guest

Replying to comment #681962:

« Return to Article