VK wrote:
Hi,
In commemoration of 8th Google anniversary my present to Mr.Cornford
According to the archives, Mr Cornford and you seem to enjoy quite an
interesting relationship, so I suppose that out of boredom you're
seeking a new fight
This thread shows that you have used a with statement, and have obtained
results you did not expect; as a result, your position is that With
statements should not be used, since they are difficult to read and also
have performance issues.
I will not comment on whether the With statement should be used; to me
it can be useful (especially in the temporary scope chain augmentation
you've been referring to), but it certainly has a particular mechanics,
that you should be familiar with if you intend to (correctly) use it.
Your pointing one aspect of this mechanics will certainly help people
unfamiliar with it to review/correct some of their code, so thank you
for sharing the issue.
<off-topic>
However, I'll comment on that "[with] is evil" title with a short story.
I happened to be, many times, the lead of programming teams. Faced with
newbies, I have realized that coding issues did not come much from their
competence (which could be leveled up) rather than their behavior to
programming.
So I worked a small introductory speech I'll share below, which will be
MY gift for Google 8th Anniversary
Inexperienced programmers present four syndromes, from which originate a
great deal of programming errors; a programming error being something
stupid that makes you stay working at night instead of enjoying video
games, for instance. Being aware and recognizing these syndromes will
help you identify situations where you are definitely going to blunder,
and, hopefully, help you to adopt the right behavior in order to NOT
blunder.
[0] is called "Magic". Computer science is deterministic, so each time
you'll be saying "it's evil", or "it works but I don't know why" or
"that damn stuff does not like me" or [long list] then this means you
lack knowledge on a subject, and that instead of acquiring this
knowledge you're trying to appeal to luck to have your stuff work. Don't
do that, extend your knowledge, learn to use the tools correctly, and
get back home earlier.
[1] is called "Don't touch me!". When a programmer's has spent a few
minutes writing something, he'll come to like it, and will refuse to
change/alter it in ANY way (he'd rather have dinner with his
mother-in-law). So if you notice you keep adding up codes to a core that
has nothing to do with it, if you call "patch" a new functionality, then
maybe the core wasn't that great to start with. Think carefully about
it, and never hesitate to start over, we all write stupid stuff
sometimes, and building a house on poor foundations... well, in the end,
you'll get back home earlier.
[2] is called "Just coding". When confronted with a coding task, the
programmer will start at once, will write hundreds of lines during
several hours, only to realize five hours and three coffee later that he
didn't understand anything to the task, and/or he didn't made some
analysis about how to perform the task in the best way. Then he feels
syndrome [1] and tries to miserably patch his work. Don't do that. Think
before coding; make sure you've understood what you have to do, why you
need to do that and what evolutions could be. Then build a flexible
framework. Then have a coffee, and then, only then, start coding. You'll
get back home earlier.
[3] is called "too easy, man!". When faced with a single little task, of
little "flashy" interest, the programmer will underestimate the task and
produce bad code, out of laziness and because he wants to come home
earlier. Then just before leaving, the boss will come and tell him, "Say
I have strange results... Have a good night here!". Never underestimate
tasks, and stay alert; something that looks easy might not be that easy.
You'll really get back home earlier.
So, to make a long story short : "[With] is evil" is definitely syndrome
[0], of course I understand you were making some humor VK, so don't take
it personally - I just stole your topic to tell a poor story
Rather, I
hope this story will help readers into recognizing faulty behaviors, and
help them get back home earlier.
</offtopic>
Kind regards,
Elegie.