Board index » delphi » Re: D2005 Code Folding

Re: D2005 Code Folding


2005-08-12 06:08:26 AM
delphi161
Quote
Actually I wouldn't have written something like that code you wrote for a
TStringList.
Neither would I. ;)
Quote
I'm not trying to confuse the creating and freeing critical sections with
the creation and destruction of objects.
<sarcasm>
Of course not...
</sarcasm>
Quote
There are other methods that one can use for the "safe" creation and
destruction of objects.
No question, IMO, non-constructor "source" methods without using Interfaces
are prone to error and I consider them bad practice.
 
 

Re: D2005 Code Folding

Nick Hodges [TeamB] writes:
Quote
Michael Anonymous writes:


>So, in this case, I think Allen was 100% correct in what he wrote.


Hmm. Let's see. Danny Thorpe, Allen Bauer, Anders Hejlsberg, and
Chuck J all disagree. At various times, I have heard all of them say
that you put the create before the try. The VCL code does it.

I wonder whom to believe here, you or them. Yeah, I wonder.

I'm not a big fan of appeal to authority.
See:
www.nizkor.org/features/fallacies/appeal-to-authority.html
Beside, the people who wrote the VCL might of had a different strategy for dealing with errors
than other programmers.
I think a competent programmer would realize that point.
 

Re: D2005 Code Folding

Allen Drennan writes:
Quote
You have to understand the way that each method
works. In the case of ECS its based on experience in the real world.
Yes, I totally agree.
 

Re: D2005 Code Folding

Michael Anonymous writes:
Quote
I'm not a big fan of appeal to authority.
I am. When it comes to issues of how to properly write exception
handling code, I will take Danny Thorpe's word on the matter over someone
who lacks the courage to post under his real name.
--
Nick Hodges -- TeamB
Lemanix Corporation -- www.lemanix.com
Read my Blog -- www.lemanix.com/nick
 

Re: D2005 Code Folding

Jason Southwell writes:
Quote
>Apparently, but Michael isn't one of them.


Well, I suspect that you and Michael are one in the same...


I thought one is suppose to read and abide by the newsgroup guidelines.
I'm trying to do my best even though I use an anonymous name.
 

Re: D2005 Code Folding

John Jacobson writes:
Quote
"Dave White" <XXXX@XXXXX.COM>writes
news:42fa9761$XXXX@XXXXX.COM...

>Yep, that was my thought reading all of Michaels replies. That and "what
>{*word*110} are you on?".


This thread reminds me of the movie "The Eternal Sunshine of the Spotless
Mind".


Have you check out Borland's newsgroup guidelines?
I certainly have.
And I try to abide by them.
Too bad you guys can not try to discuss matters without resorting to insults or related discussions.
 

Re: D2005 Code Folding

"Michael Anonymous" <XXXX@XXXXX.COM>writes
Quote
I'm not a big fan of appeal to authority.
See:

www.nizkor.org/features/fallacies/appeal-to-authority.html

Beside, the people who wrote the VCL might of had a different strategy for
dealing with errors
than other programmers.
I think a competent programmer would realize that point.
I'm not a big fan of ad hominen attacks.
See:
www.nizkor.org/features/fallacies/ad-hominem.html
 

Re: D2005 Code Folding

"Michael Anonymous" <XXXX@XXXXX.COM>writes
Quote
Brian Moelk writes:
>So please tell me how the code below executes any differently from "ECS;
>try finally LCS end;" if an exception is thrown by ECS?
>

1) The code following the try finally block will not be executed.
I'm sorry, but that response is dead wrong. If ECS throws an exception, the
code following the try/finally block will not get executed whether that ECS
call is inside or outside of the try/finally block. A try/finally block by
itself will never prevent an exception from causing the remaining code in
the routine to remain unexecuted. Only an empty try/except block can have
that effect.
If I were you, I would be concerned about a current or potential employer seeing
your posts on this topic. They are quite embarrassing, as far as I can see.
 

Re: D2005 Code Folding

"Michael Anonymous" <XXXX@XXXXX.COM>writes
Quote
Wayne Niddery [TeamB] writes:
>So then you add a try/except block where needed outside or inside any
>try/finally.
>

Yes, that is one way of dealing with the problem.
There are many good choices in life! :-)
But try/finally is not one of them in this case.
 

Re: D2005 Code Folding

Quote
>1) The code following the try finally block will not be executed.

I'm sorry, but that response is dead wrong. If ECS throws an exception,
the
code following the try/finally block will not get executed whether that
ECS
call is inside or outside of the try/finally block. A try/finally block by
itself will never prevent an exception from causing the remaining code in
the routine to remain unexecuted. Only an empty try/except block can have
that effect.
I agree. Thanks for posting that Jake, I misread the "following the try
finally block" part of his response when I wrote my response, so I am glad
you addressed his point.
 

Re: D2005 Code Folding

Michael Anonymous writes:
Quote
Brian Moelk writes:
>So please tell me how the code below executes any differently from
>"ECS; try finally LCS end;" if an exception is thrown by ECS?

1) The code following the try finally block will not be executed.
And as I already noted, the *proper* way to deal with that is *another* try
finally to guarantee that execution.
Quote
3) Potential side effects of a (known or unknown) exception is not
dealt with inside the subroutine thereby making it less future proof.
In most cases, you should not be handling exceptions locally, however
wherever it makes sense to do so, you use a try/except block - *that is what
they are for*.
Your repetition of the same mistaken logic indicates you do not understand
the use of try/finally or try/except.
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: www.logicfundamentals.com/RADBooks.html
"A man is likely to mind his own business when it is worth minding,
when it is not, he takes his mind off his own meaningless affairs by
minding other people's business." - Eric Hoffer
 

Re: D2005 Code Folding

Michael Anonymous writes:
Quote

I'm not a big fan of appeal to authority.
That depends on the authority being appealed to. If the authority is
recognized as legitimate (by the opponent as well as the appealer) then
there's really not a problem.
So unless you doubt the competence of the authorities appealed to in this
case...
--
Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com)
RADBooks: www.logicfundamentals.com/RADBooks.html
In a tornado, even turkeys can fly. - unknown
 

Re: D2005 Code Folding

Brian Moelk <XXXX@XXXXX.COM>writes
<XXXX@XXXXX.COM>
Quote
>This thread reminds me of the movie "The Eternal Sunshine of the
>Spotless Mind".

Not to me, I really, really liked that movie!
<g>
(Hey I never said which part of their relationship this thread reminds me of!)
--
Everything in this post is mere opinion.
It might be very well formed opinion based
on an uncanny grasp of the facts, but it
remains opinion nevertheless.
Here's where you will find Absolute Truth:
blogs.slcdug.org/jjacobson/
Posted with JSNewsreader-BETA 0.9.4.1063
 

Re: D2005 Code Folding

Nick Hodges [TeamB] writes:
Quote
Michael Anonymous writes:


>I'm not a big fan of appeal to authority.


I am. When it comes to issues of how to properly write exception
handling code, I will take Danny Thorpe's word on the matter over someone
who lacks the courage to post under his real name.

I never said Danny Thorpe was incorrect in his error handling strategies.
I did point out that I do think Allen's usage of putting code
he thought might fail in a try-except block was 100% correct.
Now, are you saying Danny Thorpe said you shouldn't do that?
Hmm. Show me a quote.
 

Re: D2005 Code Folding

Quote

I'm not a big fan of ad hominen attacks.
See:

www.nizkor.org/features/fallacies/ad-hominem.html
I'm not a big fan of replying to ad hominen attacks.
In this case, I couldn't let it slide.