- 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
Yes, I am. This site, while served up as humor, is really a group code-review, no?
As you say "all we know". The case at hand appears to be a set of adresses on the same mail server.
In this hypothetical case, I would still argue in favor of maintaining a set of constants with the names of the hypothetically small set of mail server names. Clearly, such a scheme falls apart for a hypothetical^hypothetical number of servers.
Now, if you're going to dynamically generate this code, rather than maintain it by hand, fine: I'm arguing art for art's sake.
However, had you that kinda smarts, would you have done this in the first place?
Admin
I actually remembered tha there is a good reason to hardcode one email address in the code. More than once I've seen an error go unreported or displayed with no informative detail because error handling was dependent on the database. This doesn't work when the DB is unavailable, for whatever reason (usually the DB being unavailable is the problem.) So you need a drop final, all-else has failed handler that sends an email to a hardcoded address. The address should not be a personal one, though. It should be a distribution list.
Admin
It's a WTF that you dozy buggers don't snip a little before you reply.
Admin
Right, UCase may have been a careless mistake, but NOT REALIZING ALL EMAIL WAS BENG SENT TO ONE PERSON because the programmer OBVIOUSLY DIDNT DO ANY TESTING, or even BOTHER TO CHECK IF THE PROGRAM WORKED, was a purposeful, conscious WTF decision by the programmer. He should be shot, hanged, drawn, quartered and fed to the sharks with laser beams on their heads.
PS: I apologize for the yelling,
Admin
The WTF looks like the UCase and comparing against lower case strings and always sending emails to Gwen.
"Gwen was an employee at the client who was responsible for forwarding emails from the system to others in her group. "
"note why the method always bothered poor Gwen ..."
These seem to say that Gwen always received the emails and no one else was receiving emails from the application.
Admin
While I'm sure that you don't have a similar process for data files, does it really make any practical difference if the email address is in a source code file or a data file? If editing it in one place can break the program then editing it in the other can. Since reading in the file is slightly more complex than hardcoding the address the odds of breaking the system are that much greater with the external file.
Leaving possible broken processes aside, if a programer is going to be making the change in any case, I don't see the practical difference between hard coded and externally stored email addresses.
Admin
The difference is that of data verus application logic. Once you have created an application that can read the data from a file or somewhere else, changing the data in the file is simple and relatively safe.
Putting it in code means you have to change your application logic every time the addresses change. It also means you cannot configure the application to use different addresses in different installations without creating different versions of your application.
Admin
I was taken in by the UCase. As a C guy I originally thought it was passing through because of the missing break statements - a quick search of VB Case set me straight.
I imagine it was tested. Mails were sent and Gwen got them. I bet they never decided to test any other case.
I have worked with a programmer like that - until the company canceled his contract. However, the damage he did to the systems he developed would make a coder's eyes bleed. Imagine 4-5 layers of OOD where specific commands are eventually translated into a string that tells the parent how to execute a task.
Better yet, imagine a VB program with only a single form, but with images created according to a layout sent by a webpage - the entire thing sent by 1 webpage of meta-layout tags. Now it rebuilds that same form with every page call. There there are image objects that he has extended so that they can function like buttons - but without full button functionality. They can only fire off an action.
but all of that is coming to an end as I start my new job.
Admin
There there are image objects that he has extended so that they can function like buttons - but without full button functionality. They can only fire off an action.
Truly I wish I had the source code, for it bears posting here.
I once saw a report criteria (cry-teria) page where someone had perverted radio buttons to work as checkboxes.
It was a monument to anti-RTFM, that page.
When I asked the project manager who had produced this [colorful language], he responded quickly that a former contractor was the perpetrator.
Later, I heard that the project manager himself had worked on that functionality at one point, and I learned something: be positive, no matter the scope of the train wreck at hand, as you never know who engineered it.
Admin
ewbi's point was pointless; if the coder was thinkning that comparisons were case-insensitive, why would he have uppercased the input in the first place?
Admin
You're right, I agree with you, and I'm sorry. I didn't mean to sound snippy in my reply to you. That wasn't my intent and I apologize.
@Charles Nadolski:
Agreed. The utter lack of testing is a major WTF.
I'm assuming that one doesn't just go straight to the external data file and edit values directly, but rather that one can only do so through the application. On top of that assumption, it should be assumed that the application will be written in such away that it validates the data going into and coming out of the external data file. When I say that the e-mail addresses shouldn't be hard coded, I do not mean that they should rather be sucked in from a text file all willy nilly like. I mean that the application should be written in such a way that the storing, retrieval, and use of the e-mail addresses is relatively painless, with errors in any part of the process being handled appropriately.
My point of view on this whole problem is that the user should be able to change which people are e-mailed various reports via a configuration screen in the application. Thus, I would argue that if the programmer has to be the one making changes to something that should be handled by the user through the application, then something is wrong.
Admin
Actually, you don't get the problem of the case statement. He converts agCode to UPPERCASE while all comparison values are lowercases. This way, it will NEVER match any of the values in the case statement and thus poor Gwen has to forward all of it to everyone else...
Admin
Admin
The coder was merely trying to make the cases execute faster by making that input YELL at the compiler...
Admin
This site is getting gold seller spam now? Seriously?
Admin
Very neat article post.Much thanks again. Much obliged. aceakfaddfgdbbfg