Member-only story
Bad Coding Practices That Seem Fine (But Aren’t!)
Bad Coding Habits You Didn’t Realize Were Hurting You
Published in
7 min readJan 6, 2025
Below are some less-discussed code and design “smells” — things that might appear harmless but can cause maintainability or testing headaches down the line.
Don’t be afraid to refactor away from these patterns, even if they seem “minor,” because technical debt grows exponentially over time.
Overuse of Private Methods Hiding Complexity
What’s the problem?
- Having a few private methods is normal for breaking down large public methods. However, when a class has a large number of private methods, it often signals that the class is doing too much.
- Complex private methods make testing harder , most testing frameworks can’t directly test private methods without reflection, so you end up either skipping important tests or resorting to hacky solutions.
- It can violate the Single Responsibility Principle if the class has many responsibilities hidden away in private methods.
Avoid doing this
public class OrderProcessor {
public void processOrder(Order order) {
// Some high-level process
validateOrder(order)…