Php – Is it recommended to use DocBlock even if I’m not using phpDocumentor

documentationPHP

I'm developing a simple website for a client.

I have read about phpDocumentor and DocBlocks, and I thought that documenting my classes and functions will be very useful.

I'm almost sure I will not generate any documentation for the site, since it's a pretty simple website, and guess what? It doesn't have an API…

But is it still recommended to write DocBlocks in my code? From what I know many programmers even don't write simple comments, but DocBlocks.
I'm not going to generate any readable documentation by the client/ next programmer but I still think that making some comments that are more than just simple text will be better.

edit – If you think that DocBlocks are redundant in my case, are there any other "standards" for writing comments / documentation?
The last time everything that doesn't have a standard makes me feel stupid, that I'm not sure if it's better to write if(){ or if () {, /* */ or //, etc.

I'm new to the documentor and DockBlocks, and I'm still not sure if I have to write this question here or in StackOverflow. Thank you very much anyway!

Best Answer

It is useful to document similar stuff in a similar way. This makes it easy to read the code as you can grasp the important things easily. Using an established standard as a foundation is useful as new team members will quickly get used to the scheme. phpdocumentor format is based on JavaDoc. The same form is sometimes used in other languages, too. Therefore even developers not familiar with PHP are more like to understand and use it quickly.

Additionally tools like IDEs support the format. And can derive information for some help from it.

If you should be strict in using it is a different question. You might use just little parts of it and modify others to your needs. Just like with any other tool ;-)

Related Topic