If I have a method that hides a button, I would probably call it HideButton
If I have a method that shows a button, I would probably call it ShowButton
But what do you guys call a ShowIfThisHideIfThat style method?
Possible Choices:
TestForButtonVisibility (this kind of sounds like it will return true/false but not actually do the work)
TestButton
ShowHideButton (style I'm currently using)
Been at this a number of years and still don't have a style that I like for these types of methods. I'm working mostly in C# and a little Java, Ruby, and F#. What do you use for method names in this regard?
// example of the style of method
public void ShouldIShowOrHideButton()
{
Button.Visible = ((chkSomeSetting.Checked) && (DateTime.Now.Day < 8));
}
Methods should be verbs in lowerCamelCase or a multi-word name that begins with a verb in lowercase; that is, with the first letter lowercase and the first letters of subsequent words in uppercase. Local variables, instance variables, and class variables are also written in lowerCamelCase .
What is an example of a good naming convention? Good naming examples include: [Project number] - Data Use Agreement - [Title of research project] Approval - Change to employee travel policy - February 2014.
Naming conventions are general rules applied when creating text scripts for software programming. They have many different purposes, such as adding clarity and uniformity to scripts, readability for third-party applications, and functionality in certain languages and applications.
Java variable naming conventions For variables, the Java naming convention is to always start with a lowercase letter and then capitalize the first letter of every subsequent word.
How about updateButtonVisibilty()
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With