Avoid verb classes

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
m (Reverted edits by Ebybymic (Talk); changed back to last version by Stephen Fitchett)
 
Line 1: Line 1:
----
 
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 
----
 
=[http://elykogit.co.cc UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY]=
 
----
 
=[http://elykogit.co.cc CLICK HERE]=
 
----
 
</div>
 
 
:''Do not turn an operation into a class. Be suspicious of any class whose name is a verb or derived from a verb. Especially those which have only one piece of meaningful behavior (i.e. do not count sets, gets, and prints). Ask if that piece of meaningful behavior needs to be migrated to some existing or undiscovered class.'' --Riel's Heuristic 3.9, [[Arthur Riel 1996]]
 
:''Do not turn an operation into a class. Be suspicious of any class whose name is a verb or derived from a verb. Especially those which have only one piece of meaningful behavior (i.e. do not count sets, gets, and prints). Ask if that piece of meaningful behavior needs to be migrated to some existing or undiscovered class.'' --Riel's Heuristic 3.9, [[Arthur Riel 1996]]
 
Class names should always consist of nouns, mostly in singular since '''one''' instance of that class will be created at a time. Classes represent real or abstract objects (like cars or computing structures) and therefore shouldn't have a verb name.
 
Class names should always consist of nouns, mostly in singular since '''one''' instance of that class will be created at a time. Classes represent real or abstract objects (like cars or computing structures) and therefore shouldn't have a verb name.

Latest revision as of 03:11, 25 November 2010

Do not turn an operation into a class. Be suspicious of any class whose name is a verb or derived from a verb. Especially those which have only one piece of meaningful behavior (i.e. do not count sets, gets, and prints). Ask if that piece of meaningful behavior needs to be migrated to some existing or undiscovered class. --Riel's Heuristic 3.9, Arthur Riel 1996

Class names should always consist of nouns, mostly in singular since one instance of that class will be created at a time. Classes represent real or abstract objects (like cars or computing structures) and therefore shouldn't have a verb name.

If a class name is a verb, this is a strong indicator that the functionality of that class can be put into an existing class. For example, the Interface Move in the Frogs design contains only three abstract method definitions. The ability to move by swimming or hopping belongs to the frog, though. If a superclass of frog is desired, the class should have the name Movable or Movable Object.

See also

Eliminate irrelevant classes

Personal tools