Uncommunicative Name


Uncommunicative Name

Symptoms

A name doesn't communicate its intent well enough.

  • One- or two-character names

  • Names with vowels omitted

  • Numbered variables (e.g., pane1 , pane2 , and so on)

  • Odd abbreviations

  • Misleading names

Causes

When you first implement something, you have to name things somehow. You give the best name you can think of at the time and move on. Later, you may have an insight that lets you pick a better name.

What to Do

  • Use Rename Method (or field, constant, etc.) to give it a better name.

Payoff

Improves communication.

Contraindications

Some teams use i/j/k for loop indexes or c for characters ; these aren't too confusing if the scope is reasonably short. Similarly, you may occasionally find that numbered variables communicate better.

Exercise 9 Names.

Classify these names as embedded type, uncommunicative, or OK.

___ addItem(item)

___ doIt()

___ getNodesArrayList()

___ getData()

___ makeIt()

___ multiplyIntInt(int1, int2)

___ processItem()

___ sort ()

___ spin()

See Appendix A for solutions.




Refactoring Workbook
Refactoring Workbook
ISBN: 0321109295
EAN: 2147483647
Year: 2003
Pages: 146
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net