Code Commenting - Best Practice

Discussion in 'PHP' started by stephan2307, Nov 11, 2010.

  1. #1
    Hi,

    I have been now programming in php for quite a few years. But I suck at commenting my code.

    Now I want to change that and I am trying to find out when the best practices are for commenting php code. Any help?
     
    stephan2307, Nov 11, 2010 IP
  2. xpertdev

    xpertdev Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    One best method to determine where to comment the code is as below:

    Look at your code and for a min consider that you have not developed it, now try to understand it. When you get problem to understand just comment those code.

    Hope this helps.:)
     
    xpertdev, Nov 11, 2010 IP
  3. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #3
    is there a specific style of commenting that is widely used?
     
    stephan2307, Nov 11, 2010 IP
  4. xpertdev

    xpertdev Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Its purely depends on what you have done in code.
     
    xpertdev, Nov 11, 2010 IP
  5. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #5
    well surely there is some form of style ie what to write in comments at the beginning of functions, classes and at the top of each file which should be independent from the actual code.
     
    stephan2307, Nov 11, 2010 IP