Michael A. Covington said:
Pardon me, but that's a bit frightening to read. Do you actually work for
Microsoft?
I do not speak for my employer and I'm sure that if there was a single
person who represents Microsoft, that person would likely distance
themselves from me quite readily.

I am required by the policy of
Microsoft to declare myself to be an employee in all communications. We are
an opinionated bunch. For every opinion I express here, I can quite easily
find someone inside Microsoft that is happy to disagree with me.
If one of my students wrote what you've just written, I'd call him in and
say, "Master the 'goto' statement yourself before you tell other people
that they are stupid for using it.
Minor correction: I did not call anyone stupid. I did call the folks who
use goto "slackers" and "luddites". That does not make them stupid. Some
of the smartest people I know fail to be motivated to learn good OO
techniques, and adherance to an idea, including the idea that "newer is not
necessarily better," does not imply either ignorance or stupidity. That
said, I will say that no code review that I have sat through wouldn't end in
a shouting match if a 'goto' was left in the code. We have code analysis
tools that will flag the use of the word and will make sure that it shows up
in the review process.
An interesting class of algorithms seems to be beyond your present
knowledge of computer programming."
I maintain that there are no algorithms that REQUIRE this simple structure
(I may be wrong on this point). I gladly concede that there are algorithms
that can be made more efficient with the use of this construct. I have
never actually coded any of them, nor have any of the other folks that I
have worked with. I have written code to run embedded in data
communications devices, code inside the operating system, code in literally
dozens of applications, code in B2B transaction systems, code in B2C
e-commerce web sites, and code in application engines ranging from workflow
to EAI. I have never happened across a single algorithm that REQUIRED the
use of a goto.
Knuth uses 'goto' in The Art of Computer Programming.
According to the following site
(
http://en.wikipedia.org/wiki/The_Art_of_Computer_Programming), Volume 1 was
published in 1968. Volume 2 in 1969 and Volume 3 in 1972. I would be
surprised if you consider these volumes to represent the complete learnings
of computer science, for to make that statement, you would state that
innovation stopped over 30 years ago.
I have a great deal of respect for Dr. Knuth. He did a great job of
describing algorithms in a simple and clear manner for two generations of
software developers to learn from. However, the needs of simplicity for
teaching an algorithm is not the same as the needs of an organization for
maintaining reliable and trustworthy code.
I don't use them often, but there are one or two 'goto' statements in my
latest and biggest (20,000-line?) object-oriented C# program. There
really are places where 'goto' is better than the alternatives.
That depends on what you mean by 'better.'
I am involved in the creation of systems where the total investment in code
will usually exceed 30 million dollars. These systems will be maintained by
people who did not write the code, often many people, with one team
replacing another. In some cases, these team turnovers can occur four or
five times while the code is still considered important enough not to sunset
it.
In this environment, the cost of a single line of code is 10 times what it
cost to write and debug it. In this environment, anything that could add
complexity or confusion MUST be factored out as soon as possible. I don't
know what kind of environment you write code in, sir, but if you were to
give me a program with a 'goto' in it, I would ask you kindly to remove it.
If you chose to disagree, I'd stop your app from going into production until
you did.
They're uncommon, but I see no advantage in being unable to recognize
them.
'Advantage' is another term like 'better' above. It has a meaning that is
relative to its context.
Have you ever programmed in assembly language?
Two processor families. Total of three years. I wrote kernel code and
telecom firmware.
There, 'goto' is obligatory, and you quickly learn how to use it
systematically and reliably.
Agreed. Thank heaven for the C programming language. The amount of
assembly that I've had to actually live with is thankfully small.
Mostly, you write things that are equivalent to loops or blocks in
higher-level languages, but occasionally, you see that a 'goto' can do
something useful that has no direct equivalent in structured programming.
Once again, that depends on your definition of 'useful'.
Slacker? Luddite? Me???
Michael Covington, Ph.D.
Associate Director, Artificial Intelligence Center
The University of Georgia -
www.ai.uga.edu/mc
I am flattered that a person of such learning would respond to my message.
I salute you for your accomplishments. Understand, however, that I do not
agree with you on this point, but not because I think you to be 'stupid.'
Far from it. It is because, in my world (and in the world of most software
developers), whether in product development or in Information Technology,
the _cost_ of a 'goto' far exceeds its _value_.
Understand that I am not interested in discussing a particular algorithm and
why 'goto' is better in that case. I'm sure that you can make a passionate
and lucid case for it. I maintain that there is no algorithm that requires
the 'goto' but I leave open the possibility that I am not correct. To be
honest, it doesn't matter. There are algorithms, I'm sure, in someone's
code, that makes use of it, and potentially to a positive effect if you view
the code only from the standpoint of performance.
I do not.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--