SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Sweden
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Coding Standard Question: Is there no limit for the max number of lines of a method?

    Coming from an application development environment (Java, C#, C++);
    Is there no limit specified by a PHP (Zend) coding standard which sets a guideline to how long the body of a method can be? When programming an application a method should only have one task, delegate everything else. And the body of a method should never be so long that you can't view it in one page (about 40-45 lines, the shorter the better).

    Are there some similar guidelines in PHP. I've never seen a guideline concerning PHP for how long methods should be.

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Here is an old thread which deals with the overall question -- OOP Methods

  3. #3
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,079
    Mentioned
    53 Post(s)
    Tagged
    0 Thread(s)
    Ha, I just had to bring this up from that thread after reading it, too funny. From @lastcraft ; on post #8

    Currently your class is a well topped cheesy pizza. If you try to separate pieces of it you will find the pieces remain joined with strands of melted cheese and some of your vegetables drop off. What we want to do is gather like vegetables together so that we can cut it cleanly without stringy bits.

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Yeah, always class stuff from @lastcraft ; I think I bookmarked half of his threads. I miss him a lot, but we never venture into anything dangerous on here any more.

  5. #5
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,079
    Mentioned
    53 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cups View Post
    but we never venture into anything dangerous on here any more.
    What do you mean?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •