Hello,
I have a question regarding the number of lines of code in a method. Mosh mentioned that having more than 10 lines of code in a method is generally considered bad practice and suggested that we should aim to reduce it. I understand this perspective.
In the “Java Advanced - Exceptions” section of his course (7th section), which can be found here: Course Link, he demonstrates using try and catch blocks. Even with a simple file read operation, the code ends up being around 12-15 lines.
Given this, how can we effectively reduce the number of lines of code while still handling exceptions properly?
Thank you!