Don’t Use Conjunctions In Method Names

Two great ideas taste great together, but not in a method.

Words like for, and, but, or, yet, so, etc can be used to extend ideas, qualify statements, apply filters, and other things. When you see these in a method name, it’s a sure sign the method is trying to do more than one thing.

A method should really only have one job, so when you see conjunctions, it’s a red flag that the previous developer piled too many things into one method. Try to refactor this into two or more methods.

Methods can then be chained together as needed. The individual, smaller methods will now be easier to re-use for other purposes. These new methods will also be easier to test.