- 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
And what's with AJAX and AJAX2? Two AJAX objects/namespaces for two different calls to the same host?
Admin
i guess its different clients where "AJAX" is faster but "AJAX2" works on old explorer versions. they could still do
var ajaxClient; if (AJAX) { ajaxClient = AJAX } else { ajaxClient = AJAX2 }
instead of duplicate codeAdmin
Code reviews are only good if you give people time to do them correctly, which takes almost as much time as the programmer did; otherwise you wind up with lots of LGTM. They also only work if the reviewers are at least somewhat as competent as the programmer. If both the reviewers and the programmers are incompetent you are just making fodder for this website.
Admin
We've all heard "If your only tool is a hammer, everything looks like a nail." I think it's also sometimes true that "If the tool in your hand at the moment is a hammer, everything looks like a nail." BTDT.
Admin
Ah, but you missed the fact that both AJAX and AJAX2 could be true, which would mean different results from your code.
And.. var ajaxClient == AJAX ?? AJAX2; or var ajaxClient == AJAX || AJAX2; is probably more what people on this site like.
Admin
Maybe they were thinking of other code where the parameters in the
AJAX.open()
calls were more dynamic. Although you can still limit the `PHP section to just that part, likeAdmin
The fact that AJAX and AJAX2 are used to determine if we're looking for a "Debut" report or a "Fin" report suggests a lot more fun in this codebase than just redundant string creation via round-trip through the PHP interpreter.
Admin
A boss who thought he could program led me to invent this saying:
If all you have is a hammer with three heads, everything looks like three nails.
Admin
That would be a boss who took a one-day training course / seminar things on "how to code", and thought afterwards(1) that "how to code" and "how to program" are the same thing, right?
(1) And probably before as well...
Admin
Now I'm picturing a three-headed hammerhead shark...
Admin
I have occasionally been guilty of similar things. Usually comes from solving a problem by taking the code for a similar problem and adapting it under a time crunch to Get It Done. I'll come back later and realize the other code was either not written well or had to handle more use cases, so it's way more convoluted than what was actually needed.
Admin
Was about to comment same. That the two URL are not the same depending on the "AJAX" version used is ... juicy.
Admin
Are we sure these are two different versions of AJAX? I'm not familiar with the old AJAX way of doing things, but this just looks like two variables named "AJAX" and "AJAX2", not classes or namespaces.
Admin
My guess would be that he might already have connections open that he wants to reuse, and only open a connection if he didn't already have one open.
That "if (AJAX)" might be determining that.
Admin
I am envious of the kind of privilege you need to think this. It takes a combination of organizational failure and success to get this kind of code merged. For most of my career, I've been on various teams that do both development and operations, and it seems like there's always at least one person who likes to deploy code directly to prod without version control. To be clear, not me, I've always been the guy who championed the idea of version control and used whatever version control was available to manage my changes prior to having an approved version control product for the team.
For one small part of my career, I was on a team where development and operations were split between two teams. The dev most prone to deploying code without version control or review was on the ops side, where he was able to continue doing that (and, in fact, in order to do development, he had to, as they didn't give operations approval to commit stuff. Not that he was supposed to do any development)
Admin
Said another way, when everyplace is a shithole of universal evil, someplace merely middle-class ordinary seems like an unrealistic paradise.