Re: Exception vs Boolean

Tech-Archive recommends: Fix windows errors by optimizing your registry



Jon,

Again you are misquoting I once have showed you that placing a message out
of the context of the thread with a text from you by only quoting parts of
the sentences.

My message was written as reply on Scott his message, where he wrote in my
opinion in the context as "try to avoid" and "do as much as possible to do
that".

If you are only able to translate as a computer instead of a human than
special for you I will change that text.

*Try* never to use an exception in a Sub because than giving back a Boolean
*in a Function* an
enum is more describing and as Scott wrote less consuming processing time.

This is a newsgroups, on every message in that everybody can split hairs,
including yours, but probably everybody avoid that, because they know the
reaction on that.

It is also amazing for a developer how many text you can write by probably
trying to put other persons messages in another context and are not able to
translate what is said by what is meant.

Cor


"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> schreef in bericht
news:MPG.1f4b40137614874498d3d7@xxxxxxxxxxxxxxxxxxxxxxx
Scott M. <s-mar@xxxxxxxxxxxxx> wrote:
Just as an example of that, Cor *appears* to believe that your post
saying to avoid throwing exceptions "when you can" (not "haphazardly" -
there's a marked difference between those two stances, IMO) means that
you should: "Never use an exception in a Sub because than giving back a
Boolean or an enum is more describing and as Scott wrote less consuming
processing time."

I have not been posting in response to Cor's messages, so I won't comment
on
what he wrote.

But don't you see that his response backs up my claim that your post
was ambiguous?

Let me ask you straight: do you believe you should never use an
exception in a Sub?

No. I have not said absolutely to use, nor have I said explicitly not use
exceptions and that is the crux of your misunderstanding of my position.

I think you're the one splitting hairs now, between saying to avoid
throwing exceptions and not explicitly saying not to use them.

If not, then clearly not everyone *did* understand your post - at least
when it was made.

Well, I don't know that you can speak for everyone. In fact, I never
commented on the use of exceptions specifically in Subs at all, so are
you
sure *you* understood my post?

I don't need to be able to speak for everyone just to say that not
everyone did understand your post. All I need to do is demonstrate a
single person who didn't understand your post, which I've done with Cor
as an example.

I personally didn't read anything into it about Subs.

Personally I'm still unclear exactly where you are in terms of
exceptions, partly because you haven't defined "system failure". The
article pretty much describes it as when a method can't do what it's
designed to do - but you haven't told us what *you* mean by it. (I
wouldn't have chosen the words "system failure" myself because there's
a nuance of failure of the whole computer (system), not just that
machine.)

Well, for a guy that likes precision, you seem to have a problem here.
You
wrote to Cor:

"See http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx
for more - it's a good article."

Which tells me you understood and agree with it. I said that I agree
with
it as well. What's the problem?

That your original post seems to be a different position. You said to
avoid throwing exceptions for performance reasons - the article
specificially says: "Do not use error codes because of concerns that
exceptions might affect performance negatively."

I think I can be forgiven for believing that you take issue with an
article which explicitly disagrees with your reasoning.

Your "avoid" post suggests a stance which is primarily one of shying
away from exceptions. This is very different from the article's point
of view. I can't tell whether we actually disagree on when exceptions
should be used, or whether you just weren't expressing yourself well in
the first post. This isn't just splitting hairs - I really don't know
where you stand.

You see those green check marks in the article you mention? You see the
red
X's? I interpre the green check marks to mean Yes and the red X's to
mean
No.

I'm not at all sure of your point - although interestingly, I don't
have check marks and crosses - I have ys with accents and another
strange character I don't know about. The joy of using Wingdings in a
web page.

I quoted that article myself and summed it up by using the same
terminology in the article (system failure). In fact, I took my comments
directly from the article. Did you even see that post? Interestgly, on
the one hand, you say it's a good article and then on the other you say
you
wouldn't use the terminolgy used in the article. Who's being ambiguous
now?

I'm saying that if I were writing the article, I wouldn't use that
terminology - but at least in the article, the terminology was
explained.

This whole thing boils down to my mistake (not knowing you would read my
post) by ending my sentence with "when you can." How about this John,

"Exceptions are expensive in terms of CLR performance and so, you should
avoid throwing them arbitrarily."

I'd say that the reasoning is flawed - that shouldn't be the main
reason for not throwing exceptions arbitrarily. Using exceptions for
non-error conditions leads to code which is harder to read. 9 times out
of 10 that's more important than performance.

Give it a rest John, you seem to be the only one hung up on verbiage.
You'll live longer without the stress you put on yourself. :)

However, other people will be more confused. I've had numerous emails
thanking me for putting to rest doubts people have had due to the
imprecision of others (most specifically about the two topics of pass-
by-reference semantics and "structs are allocated on the stack").

PS - Have you considered a career in law? You'd be great for all that
laywer-speak.

I find there's plenty of mileage in being a pedant in development. An
eye for things which may look correct at first glance but hide flaws is
handy for debugging.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


.



Relevant Pages

  • Re: Hintergrundbild einer 3D-Szene!
    ... Aus deiner Beschreibung geht nämlich nix hervor um einen Fehler zu ... Bei dem folgenden Code handelt es sich um eine Klasse, ... Public Sub PrepareMainMenue() ... '#Needs Exceptions ...
    (microsoft.public.de.german.entwickler.directx)
  • Re: How to HANDLE an Access Violation error
    ... > The MSDN states that the error mode is for a process and its child ... Does this mean that unhandled exceptions within called DLL's ... >> Exit Sub ... >> Public Function UnhandledExceptionFilter(ExceptionInfo As ...
    (microsoft.public.vb.winapi)
  • Re: GDI+ unter Windows98
    ... MathCoprozessors, um Exceptions abzufangen, setzen sie aber nicht in den ... End Function ... Private Sub FixFPU() ... Select Case Environment.OSVersion.Platform ...
    (microsoft.public.de.german.entwickler.dotnet.framework)
  • Re: Exception vs Boolean
    ... exception in a Sub? ... exceptions and that is the crux of your misunderstanding of my position. ... terminology in the article. ... I'd say that the reasoning is flawed - that shouldn't be the main ...
    (microsoft.public.dotnet.general)
  • Re: Note function
    ... you're using it in a context where the exceptions won't make a difference, ... is that definition often has a great deal to do with context. ... he gave this as an answer to my saying ... so frustrated with the constant opinion, no fact, opinion, no fact, ...
    (rec.music.theory)