Skip to main content
link added, interpunction improved
Source Link

Long methods are a code smellcode smell. They usually indicate that something's wrong, but it's not a hard-and-fast rule. Usually, cases where they are justified involve lots of state and fairly complex business rules (as you have found).

As to your other question, it's frequently helpful to segregate chunks of logic into separate methods, even if they're only called once. It makes it easier to see the high-level logic, and can make exception handling a little cleaner. Just as long as you don't have to pass in twenty parameters to represent the processing state!

Long methods are a code smell. They usually indicate that something's wrong, but it's not a hard-and-fast rule. Usually cases where they are justified involve lots of state and fairly complex business rules (as you have found).

As to your other question, it's frequently helpful to segregate chunks of logic into separate methods, even if they're only called once. It makes it easier to see the high-level logic, and can make exception handling a little cleaner. Just as long as you don't have to pass in twenty parameters to represent the processing state!

Long methods are a code smell. They usually indicate that something's wrong, but it's not a hard-and-fast rule. Usually, cases where they are justified involve lots of state and fairly complex business rules (as you have found).

As to your other question, it's frequently helpful to segregate chunks of logic into separate methods, even if they're only called once. It makes it easier to see the high-level logic and can make exception handling a little cleaner. Just as long as you don't have to pass in twenty parameters to represent the processing state!

Post Made Community Wiki by Aniket Inge
Source Link
TMN
  • 11.4k
  • 1
  • 24
  • 32

Long methods are a code smell. They usually indicate that something's wrong, but it's not a hard-and-fast rule. Usually cases where they are justified involve lots of state and fairly complex business rules (as you have found).

As to your other question, it's frequently helpful to segregate chunks of logic into separate methods, even if they're only called once. It makes it easier to see the high-level logic, and can make exception handling a little cleaner. Just as long as you don't have to pass in twenty parameters to represent the processing state!