Method Names Should Resemble the Domain

Sean Coates
Jul 30, 2017 · 1 min read

It’s always best to use business words to describe what a method is doing.


Don’t include words describing the logic in the method’s name. The logic should be hidden within the method implementation.

The method should look like a business person named it. It will be a lot more obvious to everyone what the purpose is.

data->fetchFirstPage();

This is a clean and simple method name. The business person wants the first page of data.

data->selectOrderedRowsbyOrdinalColumn(20, "name");

This looks like gibberish. It may have more functionality, but it’s simply not clear at a glance what is really being requested here or why.

Try make life easier on yourself and on the next guy who has to support the code.

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