开发者

Optimizing Codes [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 5 years ago.

Improve this question

Please provide some good coding habits that one must follow to optimize vb.net code.

Habits开发者_如何学运维 that a newbie must know while coding.

For Example,

Program to multiply the textbox length by 2 and show it in the message box

Dim a as integer  
Dim b as integer
a = textbox1.length
b = a*2 
Msgbox(b)

Better code (maybe)

Msgbox(2 * textbox1.length)


If you are a newbie, then the best thing to do is to learn the truth of Knuth's comment that premature optimization is the root of all evil. See http://www.stevemcconnell.com/cctune.htm for a detailed version of that advice.

Note that the book that chapter is from was written in the 90s. But it is a true classic that is as relevant to someone coding in vb.net code today as it was relevant to someone coding in C when it was written.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜