- 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
He obviously did not realise how and where it was useful.
Admin
Admin
On Humor Error Resume WTF
In my case, I don't know any programmers named Trent, but I could find the story completely believable with a simple name substitution. Your mileage may vary.
Admin
Oh, well, VB6 again...
Back in the day my company developed software targeted to SCO Xenix/Unix, and the installation script was done in sh.
Well, the company managed to hire a brillant person as CIO, but he didn't have a clue about Unix. He got the responsability of creating the shell scripts (go figure), and of course, the first versions were error-prone, as he didn't have idea of correctly setting the floppy disk devices.
So, each time we tried to install a product, we had to manually edit the scripts.
Fast forward some months, and all of sudden... the scripts doesn't complain, oh great!
But the software installation was failing anyway. WTF?
So I opened the install script, and found "On Error Resume Next" in shell:
mount /dev/fd0 /mnt > /dev/null cp /mnt/wtf_file.tgz /root > /dev/null chmod +x /mnt/wtf_file.tgz > /dev/null /root/wtf_file.tgz > /dev/null echo Installation successful
As many say... TRWTF is not the language... is the user.
Admin
Vista? Seriously? Why do you use Vista at work? Why do you use Vista at ANYTHING?
Admin
I have bad news for you, too...
YHBT. YHL. HAND! (or in my case, TYCA!)
Admin
TYCA? Take Your Computer Away? Type Your C Applications? Trim Your Cute A$$?
Admin
It depends on the user base.
A sufficiently naive user base should just be left alone. The software should move heaven and earth, as best it can, to recover, but there are some groups of users you just don't want to tell.
Some of them will panic. Some will freak o ut. Some will start crying.
Admin
Admin
Trolling is supposed to bait someone into a flame war. Simpy dropping inaccurate facts is the lamest troll ever.
Admin
As in: "Why is my computer telling me I am bad, that I am an invalid?"
Admin
That sounded like a flame to me.
Troll successful?
Admin
Admin
There are no great programmers.
Everyone writes bad code.
Admin
[quote user="Nagesh"] Troll successful?[/quote] Don't call me troll, madarhorn![/quote]
If you plan to imiate me, use corect Hindi speling of words, madarchod.
Admin
It's true that not all CS majors are good programmers, however those who go through the theory first and then get the experience are a hell of a lot more useful than those who don't ever touch the theory. The latter are the kind who think bubblesort is 'neat'
Admin
Last time I saw a bubblesort (in Java, no less) it had been written by the hot shot whom we had recently spent (as a company) a significant sum of money sending away to be educated because he was "promising". He used to lord it over the rest of the plebs on his section. When his bubblesort was found (with a cut-and-pasted multiplicty of 4) questions started to be asked about the efficacy of academic CS education. Unfortunately it resulted in no further training whatsoever being offered to any members of the s/w dev dept.
Admin
Best way to solve any problem,
Admin
Knowing theory is important regardless of how good a "programmer" you are. Sure there are a lot of bad CS programmers, but that doesn't make the statement any less true.
Admin
Admin
Better:
Admin
. Best:
Admin
Maybe, and I have developed both web and desktop apps targeted to both ends of the spectrum, meaning power users who appreciate a nice stack trace to those who call tech support when Caps lock is enabled... Generally, they would like to be notified that what they thought they just did, didn't go through (i.e. transaction rolled back because something failed, etc.).
I think we are talking at cross purposes here. I think those that argue "don't show user scary computer voodoo stuff" are talking about an application or transaction of absolutely no consequence (game, etc.). But any business users who use a system where their interactions drive reports, work flows, etc., want to be notified that the DB just took a shit and didn't save their month-end report, and that they can retry or call tech support, etc.
Admin
Almost...
try { // some shitty, exception prone code goes here } catch { // profit? }
Don't know about java, but in .net you can have a parameterless catch, which is exactly as useful as you would imagine. I'm sure it exists only to swallow exceptions without logging any kind of details.
Admin
Ultimately the user has a right to know what happened when they pressed a button and it didn't do as expected or advertised.
If the programmer can not explain (or even understand) what actually happens when a particular exception is thrown, or know what to do to recover from it, then the job has not been done adequately. Deciding on the language in which to report back to the user ("Aw cr*p! The browser's gone wrong! Try again!" or whatever) is more of a management / UI specialist task than a programming task, but ultimately it boils down to: the user has a right to know what's up.
Admin
Business user who work in bank is moron of highest order. These people manage whole america's money is one scray thought to me. They don't want to learn because IT tech suport is easy button for them. Just call IT abuse poor poeple and get along with daily life and play golf with there friends.
Admin
The only reason for a class not to handle an exception is if (a) the class doesn't have the information to handle it adequately, in which case it should be thrown and handled elsewhere or (b) the programmer doesn't know how to handle the exception adequately.
I challenge someone to come up with an exception which shouldn't be handled at all.
Too many people here seem to think that catching an exception means that you cannot alert the user that it took place.
Admin
So, you're saying what I said then: error messages are good?
Also regarding your comment about only l33t developers recover from exception is bullshit. How many exceptions can you realistically recover from?
I mean, there are some scenarios where you may be able to recover from an exception, but in most cases the proper way to "handle" an exception is to cleanup any resources, rollback transactions, etc., then finally let the caller know that the method call failed.
Admin
Okay so there's 2 sorts of exception:
a) The sort caused by dodgy data (which includes badly-formatted files, etc.) that is outside of the control of the program, against which the programmer should defend against. In this case the exception should be caught and processed appropriate, which means issuing a message to the inputter of data reporting on the fact that the data's duff.
b) Something internal to the workings of the program caused by an up-till-now unfound bug (e.g. overflow or div-by-zero caused by inadequate bounds checking). The latter also ought to be caught (by the aforementioned "catch (Exception e)" or whatever, and at the very minimum logged at ERROR level and the program ought to humbly mention to the user that "an unexpected error happened - please contact our tech support" (along with a unique number / code for tracking purposes) or whatever.
I would like to believe that the above is a non-controversial description of what ought to be the case for any application.
Admin
Admin
catch(TubesCloggedException tce) { //attempt recovery ... (try something)
// otherwise, cleanup code ...
// then, notify user code ...
//throw Exception throw new FailedSaveException(tce.usefulStuff); }
done.
Here, you have tried to recover, tested if recovery worked and then if it hasn't you clean up whatever mess you created, notify the user of the problem encountered and then send a more specific (hence more useful) exception to the calling class.
Even if all you did was the last of these steps, it is still much much better than just passing the more general exception down the chain.
Admin
In C++ you can throw anything, not just exceptions. i.e.
Admin
Oh okay, and a third one:
c) The infrastructure's overloaded or broken. Wah-deh-vur ...
Admin
See my post above.
Also what about c) you CAN'T handle the exception. Fuck people, if the DB is down, the DB is down.
Unless of course I'm not aligned with your definition of "handle", because my definition of handle is if you have the exception in a catch block, it's handled. What you do with it from that point on is very specific to many factors I'm not going to mention here for brevity...
There have been scenarios where, for example, I have tried to log something, but the logging failed, then you try again maybe 10 more times with 1 second between each attempt. At which point you can either try another persistence medium or lose the log.
Admin
Admin
DON'T stupid with me!
Admin
Materhorn is not hindi word!
Admin
How you handle something is as you say dependent on the scenario - however I would absolutely catch and handle an exception thrown by not being able to connect to the DB.
inside your catch statement, you might put retry attempts, maybe try a different datasource, maybe just show an error dialog for the user and then pass the exception down the chain. what you shouldn't do is just ignore it.
Can you fix everything? no, of course not. But you can still take positive action.
Admin
Glad you explained what you meant by handle...
And I'm not too sure that there is much to gain from always handling an exception. If you're not going to do anything with it, other than wrap it in another exception for the hell of it, then let it fly. Obviously there is a point (usually service layer) where you stop the exception, log all the exception details, and rethrow, with user-friendly, localized goodness without any stack info, etc. which may lead to a security issues.
Either way, I'm pretty sure we're all on the same page with this...
Admin
yeah I think we probably share the same view on this. I do think that from a theoretical perspective (infinite resources with infinite time), all exceptions should be caught and handled. I am aware that this is not always practical or cost effective though. Most companies wouldn't want to pay someone to spend time covering every single exception corner case when they could be adding more functionality for the same cost.
Admin
Not being expert in VB, I cannot make comment
Admin
Also not Swedish. GIYF.
Admin
Obviously do a good enough job of it just on your own...
Bahen Chod...
Admin
Correct Hindi word! Your really learning well to annoy people like me.
Admin
Bear in mind that there are types of exception thrown in Java that you have to put the class that declares it in a try/catch block. These are the circ where duffers put "catch (Exception e){}" and call it "handled". I'd call them "fumbled": caught and immediately dropped.
Admin
Admin
Who hasn't done something like this?
[img]http://upload.wikimedia.org/wikipedia/commons/a/aa/Klein_Matterhorn_-Zermatt-Switzerland-2005-_04.JPG[/url]
Speaking of Error'd, why are they using a comma for an apostrophe?
Admin
I wouldn't make any expectations of the user. Essentially 100% of them don't read any message boxes, errors, warnings, etc.
Depending on context, the program could stop accepting input, contact tech support itself and then include enough information to backtrack what the user did, to restore the system to a known state, make the fix, and then redo correctly.
Having said that, unless this philosophy is built-in from the start, it's very hard to do! It is done though, especially systems which rely on stateful third party entities.
Admin
Who hasn't done something like this?
[image]Speaking of Error'd, why are they using a comma for an apostrophe?
Admin
That is probably the IDE putting that catch there, or just laziness.
(the type you are referring to are called checked exceptions)