PHPBuilder - How To Document Your PHP Classes



RSS Twitter
Articles Code Documentation

How To Document Your PHP Classes

by: Stefano Locati
|
August 25, 2000

So you've read about how Object Oriented programming can help you with your big web projects and you've started it using with PHP? If you've already written a handful of classes to implement a site and you're methodic, then you should have written some documentation about them. But If you're just messy like me you've just written some comments within the classes' source and no other documentation. Without documentation it's difficult to remember methods' names and the way they have to be used (parameters and meaning). The typical way to solve this situation is to have source code files open and to skim through hundreds or thousands of lines.

Javadoc Like Documentation

There must be a better way -- if you are used to the Java language you will know the Javadoc documentation system. This tool allows you to insert tags within comments of your source files that are then parsed by Javadoc tools in order to generate a set of HTML pages documenting your classes. So while you program you can keep your browser open and you'll have a list of your classes and methods with descriptions. This will become your reference to be more productive and fast while building your web application.
In my opinion maintaining a documentation as a reference within source code is easier and more practical than having to do it in a separated document because in this way it's easier to keep it updated. Otherwise it's very easy to become lazy and postpone updates in the documentation to a time that never comes. Instead with a tool like this there is the little burden to update a tag near the source code you've just modified and to run the tool to generate again the updated html pages.

1
|
2
|
3
|
4
|
5
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Stefano Locati

Comment:



Comment:

(Maximum characters: 1200). You have characters left.