r/badcode • u/sausage-x-donut • May 12 '23
java Code written by project lead. A comment was added by my team member that the entire method can be replaced with a single line: getErrorsList().contains(message). Project lead responded that we should focus on readability and performance and not on such code review comments.
796
Upvotes
View all comments
Show parent comment
-14
u/Agilitis May 12 '23
Probably, but we are not discussing that, that's a different topic. Anyways I'm not arguing that this particular code will be a problem, but the pattern that it creates -> It is okay to create bloated functions.
All I'm saying is: more code equals more opportunity to break things. If a code can be simplified without hurting readability then it should be simplified because it creates less room for error. It is hard to argue on very few lines of code because on itself these small functions are not problems. If you have 10 thousand of lines of codes it becomes a bigger problem. I think we should always think about the patterns that we create because it might not pose a problem now, but it will down the road. I cannot explain this any better, if you only worked on small projects this does not apply.