- 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
Were those five days spent on a 'You too can learn Java in only five days!' course?
Admin
Is it possible the developer was using this as a secnod assignment in his Java 1.5 course, just after he completed a "Hello word" program?
Admin
Off topic. And rude:
I am not a native english speaker, and when I switch between (human) languages, I switch the whole stack, meaning I think in the spoken/written/read language.
So I have a hard time reading something like this, where keywords are english and own names something else.
In my limited experience maintaining other peoples code, mixed languages is a warning of other issues.
Admin
You're being too harsh, Remy. Granted that five days is a long time for this amount of code, you've got to give credit to the developer: there are two comments in the method. In my experience, that is two above the average.
Admin
Not always impossible. I worked at a small company that hired a junior programmer who clearly didn't know how to program. He was extremely nice and we all liked him. But I pulled aside the other senior developer and asked why he hired the kid. The answer was basically that the kid was nice, he was able to make a "hello, world" program without hand-holding, and we hoped he would learn as he went. It was a failed experiment IMHO.
Admin
"released to production since it passed testing" - TRWTF is the testing - given how many failure cases there are, the tests were clearly not robust enough.
Admin
The "".equals(cuitCuilOrigen) bit is especially horrible.
Addendum 2025-05-28 16:08: Also, you appear to be rashly assuming that patternNumeros actually matches only digits. I have definitely met developers where that would not be a safe assumption
Admin
So it checks for an empty string with
"".equals(cuitCuilOrigen)
AND a string shorter than the minimum length of the ID number?
cuitCuilOrigen.length() < MINIMA_CANTIDAD_ACEPTADA_DE_CARACTERES_PARA_NORMALIZAR
Does this developer envision a case where that (I presume) constant could ever be set to 0, necessitating the initial empty string check?
Admin
I wouldn't trust you with maths if you think that its possible that two comments is two more than the average....
Admin
I'm sure a lot of us have been there. I had a kid join me because my boss was a friend of his dads and apparently he had an interest in IT. In the few weeks he was there all he achieved was to spend his days in chat rooms and on ICQ and surfing for porn (which he obviously denied but MS Proxy Server was logging it all...)
Admin
Just waiting to find out that patternNumeros originally just detected digits, but since someone wanted to use it for parsing all sorts of numbers, it now also includes decimal points, thousands separators, and minus signs. And that the use of the regex was so they could apply the same logic regardless of whether the string was already formatted with hyphens or not.
Admin
Funny, I'm the opposite: I'm not a native english speaker (another Argentinian here, no relation to Nick, AFAIK) and I prefer to use spanish words for names. That's a good way to avoid mistakes, using keywords or reserved names whithout noticing.
Granted, Im not a developer but a sysadmin, so the programming languages I tend to use/read are the likes of bash, python, perl, php, where those are easy mistakes to make if not careful.
Admin
MINIMA_CANTIDAD_ACEPTADA_DE_CARACTERES_PARA_NORMALIZAR Now that is a constant name worth reading! Almost gets its own ISBN as a book in itself.
Admin
Wait, what? I could have bypassed code reviews and "forced through" just by submitting code late, with poorly designed unit tests that just have the luck of "passing"?
Darn I've been doing it all wrong the whole time!
Admin
We had something similar when we were looking to fill an senior O365 support role to lead on our migration, training and roll-out. Our director decided to employ someone who's entire experience with O365 was that she'd used it (as a normal user) a "couple of times" at her old job! His rationale for employing her was that she interviewed well and had project management experience, so that obviously meant she'd pick it up as she went along...
A couple of years later and we're only now getting towards the end of correcting all the terrible decisions and cock-ups that were made.
Admin
"".equals(foo)
is a "clever" way of doing a null check and an empty string check at the same time.