Return to site

If a method needs a flag, split the method.

· cleancode,quote
Section image

🚩 Flags in methods are a red flag.

If a method behaves differently based on a boolean flag, it’s really doing two things.

And that’s a clear sign it needs to be split. 💡

👉 “If a method needs a flag, split the method.”

Clean design means one method, one purpose — no hidden branches, no surprises. 🧩

#CleanCode #Refactoring #CodeQuality #SoftwareCraftsmanship #DeveloperTips #Programming

Go further with Java certification:

Java👇

Spring👇