- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I am a good developer. I know what I'm doing. I don't have to declare variables.
Admin
$frist = $friSt;
Admin
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".Edit Admin
I'll admit I have an ugly related pattern throughout my Python code....
Edit Admin
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.
Edit Admin
"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?
Edit Admin
Shame that with all that effort, you were frouth...
Admin
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
Admin
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.