Skip to main content
Commonmark migration
Source Link

It's perfectly alright to write lengthy functions. But it varies on the context whether you really need or not. For e.g. some of the best algorthms are expressed best when it a peice. On the other hand, a large percentage of routines in object-oriented programs will be accessor routines, which will be very short. Some o of the lengthy processing routines which has lengthy switch-cases,if conditions can be optimized via table driven methods.

There's an excellent short discussion in Code Complete 2 about the length of the routines.

The theoretical best 497 maximum length is often described as one or two pages of program listing, 66 to 132 lines. Modern programs tend to have volumes of extremely short routines mixed in with a few longer routines.

 

Decades of evidence say that routines of such length are no more error prone than shorter routines. Let issues such as depth of nesting, number of variables, and other complexity-related considerations dictate 535 the length of the routine rather than imposing a length

 

If you want to write routines longer than about 200 lines, be careful. None of the studies that reported decreased cost, decreased error rates, or both with larger routines distinguished among sizes larger than 200 lines, and you’re bound to run into an upper limit of understandability as you pass 200 lines of code. 536 restriction per se.

It's perfectly alright to write lengthy functions. But it varies on the context whether you really need or not. For e.g. some of the best algorthms are expressed best when it a peice. On the other hand, a large percentage of routines in object-oriented programs will be accessor routines, which will be very short. Some o of the lengthy processing routines which has lengthy switch-cases,if conditions can be optimized via table driven methods.

There's an excellent short discussion in Code Complete 2 about the length of the routines.

The theoretical best 497 maximum length is often described as one or two pages of program listing, 66 to 132 lines. Modern programs tend to have volumes of extremely short routines mixed in with a few longer routines.

 

Decades of evidence say that routines of such length are no more error prone than shorter routines. Let issues such as depth of nesting, number of variables, and other complexity-related considerations dictate 535 the length of the routine rather than imposing a length

 

If you want to write routines longer than about 200 lines, be careful. None of the studies that reported decreased cost, decreased error rates, or both with larger routines distinguished among sizes larger than 200 lines, and you’re bound to run into an upper limit of understandability as you pass 200 lines of code. 536 restriction per se.

It's perfectly alright to write lengthy functions. But it varies on the context whether you really need or not. For e.g. some of the best algorthms are expressed best when it a peice. On the other hand, a large percentage of routines in object-oriented programs will be accessor routines, which will be very short. Some o of the lengthy processing routines which has lengthy switch-cases,if conditions can be optimized via table driven methods.

There's an excellent short discussion in Code Complete 2 about the length of the routines.

The theoretical best 497 maximum length is often described as one or two pages of program listing, 66 to 132 lines. Modern programs tend to have volumes of extremely short routines mixed in with a few longer routines.

Decades of evidence say that routines of such length are no more error prone than shorter routines. Let issues such as depth of nesting, number of variables, and other complexity-related considerations dictate 535 the length of the routine rather than imposing a length

If you want to write routines longer than about 200 lines, be careful. None of the studies that reported decreased cost, decreased error rates, or both with larger routines distinguished among sizes larger than 200 lines, and you’re bound to run into an upper limit of understandability as you pass 200 lines of code. 536 restriction per se.

Post Made Community Wiki by Aniket Inge
Source Link
sarat
  • 1.1k
  • 3
  • 11
  • 19

It's perfectly alright to write lengthy functions. But it varies on the context whether you really need or not. For e.g. some of the best algorthms are expressed best when it a peice. On the other hand, a large percentage of routines in object-oriented programs will be accessor routines, which will be very short. Some o of the lengthy processing routines which has lengthy switch-cases,if conditions can be optimized via table driven methods.

There's an excellent short discussion in Code Complete 2 about the length of the routines.

The theoretical best 497 maximum length is often described as one or two pages of program listing, 66 to 132 lines. Modern programs tend to have volumes of extremely short routines mixed in with a few longer routines.

Decades of evidence say that routines of such length are no more error prone than shorter routines. Let issues such as depth of nesting, number of variables, and other complexity-related considerations dictate 535 the length of the routine rather than imposing a length

If you want to write routines longer than about 200 lines, be careful. None of the studies that reported decreased cost, decreased error rates, or both with larger routines distinguished among sizes larger than 200 lines, and you’re bound to run into an upper limit of understandability as you pass 200 lines of code. 536 restriction per se.