Re: C++ Guidelines
"Pete Vidler" <pvidler@mailbl ocks.com> wrote in message
news:OVZdc.83$7 w.18@newsfe1-gui.server.ntli .net...[color=blue][color=green]
> >
> > A suggestion. Functions could easily be longer once you add blank lines[/color][/color]
and[color=blue][color=green]
> > comments. Functions that are pretty straightforward but long, say[/color][/color]
because[color=blue][color=green]
> > they have to read in a lot of input arguments, are fine, it seems to me.[/color][/color]
As[color=blue][color=green]
> > soon as you start to process input arguments and do stuff, that's when[/color][/color]
the[color=blue][color=green]
> > long function should raise a bell.
> >
> > A related concept is that functions should have few input arguments.[/color]
>
> I usually adhere to this one because I find that I make fewer mistakes
> if the entire method is immediately available. I'm not sure how this
> relates to the number of arguments, but I'll accept that as a suggestion.[/color]
Worry about cohesion rather than number of lines. If you worry too much
about number of lines, then you'll start breaking down every 2 lines into
function, and that can make things *less* readable ultimately.
"Pete Vidler" <pvidler@mailbl ocks.com> wrote in message
news:OVZdc.83$7 w.18@newsfe1-gui.server.ntli .net...[color=blue][color=green]
> >
> > A suggestion. Functions could easily be longer once you add blank lines[/color][/color]
and[color=blue][color=green]
> > comments. Functions that are pretty straightforward but long, say[/color][/color]
because[color=blue][color=green]
> > they have to read in a lot of input arguments, are fine, it seems to me.[/color][/color]
As[color=blue][color=green]
> > soon as you start to process input arguments and do stuff, that's when[/color][/color]
the[color=blue][color=green]
> > long function should raise a bell.
> >
> > A related concept is that functions should have few input arguments.[/color]
>
> I usually adhere to this one because I find that I make fewer mistakes
> if the entire method is immediately available. I'm not sure how this
> relates to the number of arguments, but I'll accept that as a suggestion.[/color]
Worry about cohesion rather than number of lines. If you worry too much
about number of lines, then you'll start breaking down every 2 lines into
function, and that can make things *less* readable ultimately.
Comment