go_to使用它们的原因 [英] go_to what's in using them

查看:79
本文介绍了go_to使用它们的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直听说不要在代码中使用''go_to''。但是,我不知道
知道它背后的原因是什么?


这里的任何人都可以解决这个问题吗?


在此先感谢,

Manish

I keep hearing about not to use ''go_to'' in your code. However, I don''t
know what''s the reasoning behind it?

Can any one here shed some light?

Thanks in advance,
Manish

推荐答案

在文章< 11 **********************@h48g2000cwc.googlegroups .com>,
ma **** @ gmail.com < ma **** @ gmail.comwrote:
In article <11**********************@h48g2000cwc.googlegroups .com>,
ma****@gmail.com <ma****@gmail.comwrote:

>我一直听不到在你的代码中使用''go_to''。但是,我不知道它背后的原因是什么?
>I keep hearing about not to use ''go_to'' in your code. However, I don''t
know what''s the reasoning behind it?


>这里的任何一个人都能解释一下吗?
>Can any one here shed some light?



您可能希望搜索出名的文章,

Go To Statement Considered Harmful作者:Dijkstra。

-

一切都是虚荣心。 - 传道书

You may wish to search out the famous article,
"Go To Statement Considered Harmful" by Dijkstra.
--
All is vanity. -- Ecclesiastes



ma **** @ gmail.com 写道:

我一直听说你的代码中没有使用''go_to''。但是,我不知道这背后的原因是什么?


这里的任何一个人都可以解决这个问题吗?
I keep hearing about not to use ''go_to'' in your code. However, I don''t
know what''s the reasoning behind it?

Can any one here shed some light?



参见Wirth文章引用elsethread。


总结:

a)最大的成本在开发中是程序员的成本。

b)程序员花费更多时间来调试和维护现有代码比开发新代码花费更多时间

c)使用goto的使代码维护变得复杂,因为它增加了逻辑路径的数量,同时提供很少或没有视觉指导来维护程序员

d)因此导致程序员花费更多时间和精力

了解现有逻辑并开发合适的新逻辑,即
不会与现有的goto语句冲突,

e)因此导致不必要的开发时间和成本膨胀

f)另外,使用goto使代码调试变得复杂,因为它没有留下来回溯,

g)因此导致程序员花费更多的时间和精力搜索

for possible隐藏的逻辑路径导致异常情况,因此导致不必要的调试时间和成本膨胀


另一方面,无意识的编程离开了代码处于一个易于

可读状态,其中所有逻辑路径都明确分隔。因此,开发和维护程序员花费更少的时间来尝试理解代码,这样可以节省开发成本(时间和金钱)

。 br />

HTH

-

Lew

See the Wirth article referenced elsethread.

To summarize:
a) the biggest cost in development is the cost of the programmer.
b) programmers spend more time debugging and maintaining existing code
than developing new code
c) the use of "goto" complicates code maintenance as it increases the
number of logic paths, while providing little or no visual guidance to
the maintenance programmer
d) thus causing the programmer to spend more time and energy
understanding the existing logic and developing suitable new logic that
will not conflict with the existing goto statements,
e) thus causing an unnecessary inflation of development time and costs
f) Also, the use of "goto" complicates code debugging as it leaves no
trail to backtrace from,
g) thus causing the programmer to spend more time and energy searching
for possible hidden logic paths that lead to the abnormal condition,
h) thus causing an unnecessary inflation of debugging time and costs

On the other hand, gotoless programming leaves the code in an easily
readable state in which all logic paths are clearly delimited. Thus
development and maintenance programmers spend less time trying to
understand the code, which keeps development costs (time and money)
down.

HTH
--
Lew




Lew Pitcher写道:

Lew Pitcher wrote:
ma **** @ gmail。 com 写道:

我一直听说你的代码中没有使用''go_to''。但是,我不知道这背后的原因是什么?


这里的任何一个人都可以解决这个问题吗?
I keep hearing about not to use ''go_to'' in your code. However, I don''t
know what''s the reasoning behind it?

Can any one here shed some light?



请参阅引用elsethread的Wi​​rth文章。


See the Wirth article referenced elsethread.



对不起,我的意思是Dyjkstra,而不是Wirth

Sorry, I meant Dyjkstra, not Wirth


这篇关于go_to使用它们的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆