开发者

Function Name Conventions(Any Kind of PL) [closed]

开发者 https://www.devze.com 2023-03-13 13:06 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. 开发者_JAVA技巧 Closed 11 years ago.

Is it bad to use Underscores in Function Names? Can I know the reason why? ie: Function GET_NAME(byval sword as string) as string


Not at all. The coding convention is a very subjective term. One might feel one coding style great and another find it worse. The key point is maintain one coding style only throughout your code for ease of upcoming developers and maintainers.

However, avoid all caps for function names (as shown in your example). It's generally reserved for macros (C/C++) / constants.


I would use them sparingly in my own API, but to say that they are bad is simply untrue. If so, .NET specifically would have problems with default naming for event handlers!

void Form_Load( //...
void Page_Load( //...
void btn_Click( //...
// etc.


In this specific case, all caps with underscore separators are generally understood to be constant values.


Firstly, its very subjective matter and depends from Person to Person. One may feel like using _ in function, others may not. There's no harm if you use it.

Frankly speaking, you don't usually use _ sign. But, you can to use this '_' in the variable declaration.


Note : You can check out the msdn link ( atleast for C#, Visual Basic, C++ )

0

精彩评论

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

关注公众号