Long Method
noun
say it: “LAWNG METH-ud” /lɔŋ ˈmɛθəd/
A method that does several jobs one after another, often in sections marked by comments.
What is a long method?
A long method is a code smell: one method doing several jobs in a row, such as checking for room, working out a price, taking a place and confirming it. Its comments often name the jobs inside it. Nothing in it can be reused or tested on its own, so a new feature copies part of it. The cure is to pull out a method for each job, named after its comment.
In a sentence
- “The new button needed two checks buried in the middle of a long method.”
Level: Apprentice · More Software Development terms at this level
Updated