开发者

To separate functions or not to separate functions? That is the

At this point in time I am approaching the 1800 line mark in my code.

It contains a series of different forms and one big function which checks, validates, and determines the next step in the process. I have a total of 12 functions and I'ld like to know the开发者_Python百科 programming philosophies and thoughts on whether or not (or when?) to separate the functions into their own file and when to leave them all on the same page.

Any thoughts on both your style of programming and any links to established programming standards of a particular group or philosophy of programming?

Thanks


According to Code Complete book, a function needs to contain -one- logical unit, if it contains more than one, then break it into two functions. Another hint is if function name is too cumbersome or long. That too is a hint about a function that can be refactored.

Incidentally, Code Complete book should be on reading list of any serious software developer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜