Don’t Use Conjunctions In Method Names

Sean Coates
Jul 26, 2017 · 1 min read

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.

Sean Coates

Written by

Occasional posts from @fooyay about software engineering, crypto, finance, and more. https://about.me/fooyay (Content reflects my opinion and not my employer.)

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade