Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

abstract class naming convention [closed]

Should we have a team coding standard that the names of abstract classes have prefix Abstract ? e.g.

public abstract class AbstractB implements B {} 
like image 768
Paul McKenzie Avatar asked Jul 28 '11 15:07

Paul McKenzie


2 Answers

Yes, in fact if you look at the javadocs of the standard library at http://download.oracle.com/javase/6/docs/api/ you'll find that the list of classes in the bottom-left frame begins with abstract classes using the naming convention you have mentioned in your question.

AbstractAction AbstractAnnotationValueVisitor6 AbstractBorder AbstractButton AbstractCellEditor AbstractCollection AbstractColorChooserPanel AbstractDocument AbstractDocument.AttributeContext AbstractDocument.Content AbstractDocument.ElementEdit AbstractElementVisitor6 AbstractExecutorService AbstractInterruptibleChannel AbstractLayoutCache AbstractLayoutCache.NodeDimensions AbstractList AbstractListModel AbstractMap AbstractMap.SimpleEntry AbstractMap.SimpleImmutableEntry AbstractMarshallerImpl AbstractMethodError AbstractOwnableSynchronizer AbstractPreferences AbstractProcessor AbstractQueue AbstractQueuedLongSynchronizer AbstractQueuedSynchronizer AbstractScriptEngine AbstractSelectableChannel AbstractSelectionKey AbstractSelector AbstractSequentialList AbstractSet AbstractSpinnerModel AbstractTableModel AbstractTypeVisitor6 AbstractUndoableEdit AbstractUnmarshallerImpl AbstractWriter 

Take any one of them, say the first one, and check its definition: AbstractAction. It indeed implements Action which is again similar to your convention. It's subclasses are named like: ClosedAction, MaximizeAction, etc.

like image 156
Susam Pal Avatar answered Oct 05 '22 21:10

Susam Pal


Generally any kind of standard is a good thing in a team setting. Otherwise team members might name classes in such a way that only they understand and then you could get a mix of people's different coding styles which leads to confusion.

like image 42
KennyRules Avatar answered Oct 05 '22 20:10

KennyRules