Method name

Method name

A method name in object-oriented programming is an identifier not only uniquely identifying a subroutine or event handler, but more importantly providing a hint to the programmer (or other programmers) about what the method can be expected to do.

In general

It's considered good practice to form a method name out of a verb, or a combination of noun and verb.

For example:
* init() // meaning, "initialize"
* CalculateTotal
* shape.print()

For event handling

For example, an event handler called btnExit_Click would reasonably be expected to respond to a mouse click event on a form's exit button. The convention used in VB and C# is to combine the name of a control with the name of the event that acts on it, separated by an underscore character. Another example might be txtAmount_lostFocus used when the focus leaves an amount-entry textbox; the program could respond with a data validation routine.


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Name of the Game (disambiguation) — Name of the Game is a song by The Crystal Method. Name of the Game may also refer to: The Name of the Game , a song by ABBA The Name of the Game (TV series), an American drama series starring Gene Barry The Name of the Game (Grey s Anatomy), an… …   Wikipedia

  • Name mangling — This article is about name mangling in computer languages. For name mangling in file systems, see filename mangling. In compiler construction, name mangling (also called name decoration) is a technique used to solve various problems caused by the …   Wikipedia

  • Method signature — In computer programming, especially object oriented programming, a method is commonly identified by its unique method signature, which usually includes the method name, and the number, types and order of its parameters.[1] A method signature is… …   Wikipedia

  • Method (computer science) — In object oriented programming, the term method refers to a subroutine that is exclusively associated either with a class (called class methods, static methods, or factory methods) or with an object (called instance methods). Like a procedure in… …   Wikipedia

  • Method overriding — Method overriding, in object oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes. The… …   Wikipedia

  • Method chaining — is a common technique for invoking multiple method calls in object oriented programming languages. Each method returns an object (possibly the current object itself), allowing the calls to be chained together in a single statement.[1] A method… …   Wikipedia

  • Method ringing — (also known as scientific ringing) is a form of change ringing (the practice of ringing a series of mathematical permutations on tuned bells, rather than a melody). In method ringing, the ringers are guided from permutation to permutation by… …   Wikipedia

  • Method overloading — is a feature found in various programming languages such as Ada, C#, C++ and Java that allows the creation of several functions with the same name which differ from each other in terms of the type of the input and the type of the output of the… …   Wikipedia

  • Method Man & Redman — Also known as Meth Red, Red Meth Origin Staten Island, New York City Newark, New Jersey Genres Hip hop Years active …   Wikipedia

  • Method Man (film) — Method Man Directed by Jimmy Shaw Produced by Jimmy Shaw Starring Peter Chen Lau Chan Wai Lau Fei Lung Casanova Wong Kwok Chu Wong Release …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”