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

Leave a comment on “The Last Last Name”

Log In or post as a guest

Replying to comment #:

« Return to Article