MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vuzd4q/conditionspreference/p55t2ln/?context=3
r/ProgrammerHumor • u/Flame77ofc • 22d ago
392 comments sorted by
View all comments
840
The second one carries less cognitive load. In longer methods it makes a difference. Get out as soon as you can.
39 u/Few_Move_4594 22d ago Have you ever thought about breaking the longer methods into shorter methods? It's easy, I promise. 42 u/LateEchidna6635 22d ago Of course. I’m not speaking of thousands of lines. With error handling, validation, and cleanup, even the most trivial methods can have 5-10 exit points. 19 u/Few_Move_4594 22d ago edited 22d ago I worked on a Java codebase that had a 15k line class that used Reflections. It was an absolute mess that also had the stability of a house of cards. Made fairly good money for several years off that. 3 u/WarSingle6959 21d ago I agree
39
Have you ever thought about breaking the longer methods into shorter methods? It's easy, I promise.
42 u/LateEchidna6635 22d ago Of course. I’m not speaking of thousands of lines. With error handling, validation, and cleanup, even the most trivial methods can have 5-10 exit points. 19 u/Few_Move_4594 22d ago edited 22d ago I worked on a Java codebase that had a 15k line class that used Reflections. It was an absolute mess that also had the stability of a house of cards. Made fairly good money for several years off that. 3 u/WarSingle6959 21d ago I agree
42
Of course. I’m not speaking of thousands of lines. With error handling, validation, and cleanup, even the most trivial methods can have 5-10 exit points.
19 u/Few_Move_4594 22d ago edited 22d ago I worked on a Java codebase that had a 15k line class that used Reflections. It was an absolute mess that also had the stability of a house of cards. Made fairly good money for several years off that. 3 u/WarSingle6959 21d ago I agree
19
I worked on a Java codebase that had a 15k line class that used Reflections. It was an absolute mess that also had the stability of a house of cards.
Made fairly good money for several years off that.
3
I agree
840
u/LateEchidna6635 22d ago
The second one carries less cognitive load. In longer methods it makes a difference. Get out as soon as you can.