Utility pattern

Utility pattern

The Utility pattern is a creational software pattern that is used for utility classes that do not require instantiation and only have static methods. The statelessdn class uses a private constructor so that no instances can be created. Good candidates for utility classes are convenience methods that can be grouped together functionally.

Furthermore, methods in Utility classes are usually deterministic. As the Utility class is stateless, all parameters in each method must pass all necessary information to the method.

"Example in C#

class Utils { private Utils() { //private constructor is used in utility pattern so that no instances can be created. } ///

/// Utility Pattern methods are access by class name since methods are static ones. /// public static void function1() { //Utility Pattern contains only static methods MessageBox.Show("This is function1 from utils"); } public static void function2() { MessageBox.Show("This is function2 from utils"); } }"

Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Utility class — In computer programming, a utility class is a class that defines a set of methods that perform common, often re used functions. Most utility classes define these common methods under static (see Static variable) scope. Examples of utility classes …   Wikipedia

  • utility and value — ▪ economics Introduction       in economics, the determination of the prices of goods and services.       The modern industrial economy is characterized by a high degree of interdependence of its parts. The supplier of components or raw materials …   Universalium

  • Utility pole — A utility pole, telegraph pole, telephone pole, power (electricity) pole, or telegraph post is a pole used to support overhead electrical wires, cables, and optical fiber and associated equipment. They may carry both wires to distribute electric… …   Wikipedia

  • Marine Corps Combat Utility Uniform — MARPAT Utility Uniform The Marine Corps Combat Utility Uniform (MCCUU) is the current battledress uniform of the United States Marine Corps. It is also worn by Navy personnel (mostly corpsmen and chaplains) assigned to Marine Corps units (Fleet… …   Wikipedia

  • Northwest Austin Municipal Utility District No. 1 v. Holder — Supreme Court of the United States Argued April …   Wikipedia

  • Category utility — is a measure of category goodness defined in Harvtxt|Gluck|Corter|1985 and Harvtxt|Corter|Gluck|1992. It was intended to supersede more limited measures of category goodness such as cue validity (Harvnb|Reed|1972;Harvnb|Rosch|Mervis|1975) and… …   Wikipedia

  • Observer pattern — The observer pattern (a subset of the publish/subscribe pattern) is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes,… …   Wikipedia

  • 1908 and 1912 Pattern British Army Cavalry Swords — The 1908 Pattern Cavalry Trooper s Sword (and the 1912 Pattern, the equivalent for officers) was the last service sword issued to the cavalry of the British Army. It is widely considered [ cite book |last=Robson |first=Brian |title=Swords of the… …   Wikipedia

  • Anti-pattern — For the book, see AntiPatterns. In software engineering, an anti pattern (or antipattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.[1][2] The term was coined in 1995 by Andrew Koenig,[3]… …   Wikipedia

  • Multi-Terrain Pattern — British Multi Terrain Pattern The Multi Terrain Pattern is a camouflage pattern printed on equipment issued to British forces. As part of the MOD s PECOC programme, three new camouflage patterns were being considered for issue to British forces.… …   Wikipedia

Share the article and excerpts

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