Bad Coding Practices That Seem Fine (But Aren’t!)🧵 1) Overuse of Private Methods Hiding Complexity Too many private methods break flow and scatter logic. It looks clean but hides critical reasoning steps. Avoid it when: You’re breaking things into private methods just for the sake of it, not because they’re reusable or meaningful. Better Approach : Split out the different responsibilities into collaborating classes or services.
2) Making Everything “Private + Getter/Setter” by Default Blindly adding getters/setters turns OOP into glorified structs. It breaks encapsulation rather than preserving it. Instead - Only provide getters/setters that make sense for your business logic. - Consider replacing “setters” with methods that perform meaningful actions and validations.
@theskilledcoder 😅 If you name your methods like “process”, “stepOne”, it is no wonder, that too many of them are hard. IMHO: Better naming is the solution and not avoiding private methods.
@theskilledcoder I don't understand why the methods have to be public due to this reason. Methods are publics/privates due to reasons based on semantic. If I have to make private 300 methods, why do I have to make publics?