- 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
The frist RWTF:
"... rather gigantic Perl codebase."
... nuff sed.
Admin
Yeah, it could be a bit awk ward.
Admin
"And then they left." Who left? Management? The lone developer? The development team? The sane code-review policies?
Admin
You absolutely sure that mandatory Pair Programming is a good idea?
Because I'm not.
Admin
It has its place, for example walking a new developer through bits of logic. But it would be madness to mandate that all programming be Pair Programming.
Admin
"Mandatory Pair Programming" does not necessarily mean "All code has to be created with Pair Programming". It could also mean "Every developer has to do 2 hours of pair programming per week with rotating partners". Small step towards sharing knowledge and best practices, right?
Admin
A completely useless step, in my experience. Which also causes much pain amongst the more introverted, not to mention pointless shouting matches.
But yes, I guess that qualifies as "small," in a non-utility dimension.
Admin
its value
Admin
"checks the last index of the errors array" would normally mean examining the value at the last index, and would (normally) be written as `$errors[-1]".
The "$#" syntax returns the index of the last position of the array, or 1 less than the length. (Assuming your index started at zero, which believe it or not Perl would let you change, even though every time I saw it mentioned it was immediately follow by "Don't do this."). So essentially this was `if( array is empty )".
Much as I love Perl, things like this make me understand why many people hate Perl.
Admin
Who sed? (Sorry, just couldn't resist. I should probably work on that)
Admin
Things like this are not Perl.
This is Perl:
if (@array) { ... }
You can write bad code in any language. I wouldn't get someone who barely speaks French to write French, but apparently it's normal to get people who barely speak Perl to write Perl. And so the cycle of people hating Perl continues.
Admin
Oh no, the article mentioned Perl. I wonder if TDWTF readers are worldly enough to not make the same tired, uninformed comments about Perl as the rest of the internet.
I guess not.
Admin
To be fair, if $group_name contained a number, that interpolation of it wouldn't do anything terrible. If it contained undef or a reference it would be generally bad news though.
And please don't ask me about the number off times I've seen people stringingifying undef (or None if in python code) and wondering why things subsequently went haywire
Admin
'nuff sAd, you mean... (?)
Admin
And it completely ignores the idiomatic way of just saying
if (@someArray) { ... }
to mean "if the array isn't empty".Admin
Perl hasn't allowed you to change where its array indexing start for at least a decade and a half, and has been screaming loudly if you try to do so for years before finally disallowing it.
Admin
Pointless shouting matches? There shouldn’t be any shouting in a professional environment, pointless or not!
Admin
True but from my experience with my own code – thrown away and replaced by python mostly – it makes it particularly easy to get “smart” about the bad code.
That said, it might also be because Perl was my Master-thesis time use case of scripting language that ended up teaching me about how not to write code due to being unable to debug and extend it a year later.
Or maybe the part where it is a dynamic language without a built-in repl. Then again, I never really used it with a proper IDE either.
Makes me wonder if other people also have made the experience of burning their ha da in Perl mostly due to their own lack of experience at the time?
Can't find a reason to use Perl though, when I could use python instead, unless I can't install python on the target machine.
Addendum 2023-01-24 03:20: That said, Python has some "implicit casting" behavior too, that creates similar annoyances. Like how passing a string instead of a single-element list of strings will often be misinterpreted as the list of characters instead of raising and exception. Or f-stringw silently steingifying methods, when you mistake them for a property.
Admin
Using $var = "$var"; can do 'bad things' if the $var is not a primitive (scalar). For instance if $var is an object, and either the tostring or th destructor has unexpected side effects you are in for a surprise.
Especially adding side effects to tostring is pure evil.
The destructor could also give strange behavior if sometimes $var is the only reference to the object and other times not....
Admin
"All"? Rarely true for ANYTHING .... but pair program, done well (93% is done very poorly according to studies) is fantastic. Definitely my preferred method of working.
Admin
My favorite was the job interview where the hiring manager was talking about how they have adapted agile development. On the scrum board was a single note saying "introduce agile".
Admin
Laughs in old man retired IT guy.
Admin
My guess is that someone wanted to be able to insert a breakpoint to see the value of $group_name before it was changed. I've done similar things, although unless I was quite confident about the stupidity of the compiler, I'd use something like $temp = $group_name so it wasn't so obvious that the line could be optimized away.
Of course, as Yazeran said, you have to be sure $group_name is only a variable, not a construct with side effects.