Warrio said:
and I'm more disappointed to see an MVP treating someone's code of
garbage!!
I was commenting on David's suggestion, not your code.
This is not personal (at least not for me).
He just stated it helps to prevent garbage code. I saw NOTHING in the that
suggestion that pointed towards YOUR code being garbage. \
It would be much the height of hypocrisy if you were to stand here and speak
of not criticising, but then go about doing exactly that.
You seem to think that suggestions here should be limited to the exact
question, and nothing beyond the question should be suggested here? This can
hardly be argued as a means to enlightenment, and learning that supposed to
go
on here. How can we really stand here and talk about having open minds when
you can't accept suggestions that are the *norm* in our industry?
As you said, it is really a matter of your needs. There no need to take any
of this personal at all. I certainly not make it personal, and I can't speak
for others who posted here.
Option explicit is a time honoured practice. it is a good thing, and the
VAST majority of developers use it. You can certainly try to make a case as
to
why you do things the way you do. However, those points you make likely will
not convince many here. You asking for the majority of software craftsman to
throw out something that they realized on for years.
It like changing oil in your car. If you don't change it tomorrow, the
engine
will not fall out, but lets at least admit it a good idea to change oil. If
you walk into a room of experienced mechanics, and tell them you don't need
to
change oil, you going to get a harsh reaction.
The same occurs for option explicit.
If you going to convince anyone of your position, then you have to make a
better case.
1. if I declare them all, I can have useless variables within my code.
and in Access the optimizer doesn't tell you that as it does in Delphi for
example.
Well, ok, but how often and how much is this a legitimate problem? It is
not
a problem that outweighs, or convinces anyone that you should not use option
explicit. so what, you have a un-used variable. It just not a big deal.
Declaring variables at the start of routine is a instant documentations as
to
how large, how complex, and what kinds of variables are to be expected in
the code that follows. Anyone who optimizes their time and wants to make
a estimate of the code they are about to read needs this information. It
would
be asking to not asking how many pages are in a book before you tart reading
it.
So, the dim's and declares at the start of routine thus provide valuable
documentation of the code that follows. And, hopefully, some of the
variables
are explained. Further, it means that all variables are defined in ONE
PLACE.
So, if I have to modify YOUR code, I can use ctrl-up arrow, and I am
transported to the top of the routine, and presto- I have a list of
variables
used. If you don't have a nice list of variables to pick from, then I can
ASSURE YOU that your suggestion that not using option explicit will results
in MORE variables being used then necessary, because you have no handily
list of
current variables for the routine! Are you actually telling me that I have
now look through ALL OF the code to see what variables are being used? That
is far worse of a problem.
So, your bullet point #1 is not a convincing reason.
Further, while there is not built in tools, the free mztools will find and
display un-used variables anyway. Further, mztools also allows you to view
what subroutines and other code CALLS YOUR EXISTING code routines your are
in. (this is invaluable). Often, while in code when the cursor is on a
function name for sub name, then I use shift-f2 to "jump" to the other
routine (sub, or function).
And, ctrl-shift-f2 un-corks you back
the way your came through the code. The free mztools will also show what
routines call the code your in. I can't tell you have valuable that is.
mztools can also insert error handling code for you also. It is near must
have, and it is free. So, the free mztools will find those un-used vars for
you
http://www.mztools.com/index.htm
The benefit of declare variables is not speed or space. And, to further
clear
my answer, those variant type variables use the same space in each case
until
they are initialized.
Anyway, the use of option explicit is much that of forcing documentation for
the
software. It like a table of contents of the following code. As a developer
you will QUICKLY realize that maintains of code is FAR MORE expensive then
that of writing code (or running code).
The other issue is hidden errors in code. If you miss type a var name, and
ship your code, you can have hidden errors in it. Option explicit resolves
these errors at compile time, and thus finds errors BEFORE you run the code.
Even if your a 1st rate debugger, it makes no sense to use human time and
cost in place of what a machine can do.
your messages telling me what I "should do"... is far away from my original
question. and if you reply to a message in a forum, you are supposed to give
some help on what people asked, not telling them about which shirt color
they should wear...
I think giving answers that don't expand beyond the actual question is
rather rude. You mean I should give you directions to get around the
mountain,
but leave out that the next corner has a cliff?
Further, we not talking about the color of your shirt, we talking about and
learning about software development. There is HUGE grand canyon here about
telling
you what color of clothes as compared to that of what seasoned software
developers do.
You mean you want to ask about what kind of knife a butcher should use to
cut pork, but not accept suggestions that the knife should be clean ad also
sharp? Gosh, you telling me that this forum is not to be become a place of
learning, and enlightenment, but the cold hard fact of dishing out answers?
Why would anyone here volunteer to become a robot answering machine?
Without a discussion and learning process, this free group would fall
apart in an instant.
You are walking into a public form for the exchange, and learning of ideas
about ms-access. The people here are not paid to do this.
If you only want to only have "yes" sir answers that don't go beyond
anything else you don't want to hear, then that is called a paid employee!
And, further, you have to tell that person you don't want to hear anything
beyond exact what you asked? (by the way, that is the exact type of
environment
that most creative people will not work under). I can't imagine trying to
work in that kind of environment! You seem to think software is like
Macdonald's. It is a very creative and engauging type of process.
By the way, I don't think you done anything wrong. However, walking into a
room and disagreeing with everyone is not some big moral wrong, but it
certainly a way to fight a up hill battle...
And, please accept my honest ad sincere apologies if anything I said was
rude, offensive, or put this whole discussion in a wrong light.
I have no beef with you, and I look forward to continued to discussions
about software, ms-access. And I will also be most happy to continue to help
and answer your questions to the best of my ability.
And, lets all have a great day. Life needs to be enjoyable! It is 7:37
am..and I am going to grab a coffie!!!...