[wp-hackers] do you guys distinquish between various PHP commenting options?
J.D. Grimes
jdg at codesymphony.co
Fri Jul 18 21:08:16 UTC 2014
For single line comments, use //. I couldn’t find it in the coding standards (http://make.wordpress.org/core/handbook/coding-standards/php/), but I think # is discouraged. At any rate, // is what is generally used in core. The /* */ comments are extra writing, unless your comment has to be in the middle of a line of code (which it almost never does), so you need to close it.
As far as minifying the PHP source, this would reduce download time, but it would also increase confusion, and make debugging more difficult. WordPress core isn’t that large, so it isn’t worth it. Even if a user is never going to be looking at the code, if they get an error it is easier to help them debug if the line the code is coming form is unambiguous. All you need to know now is the version. If minified code was offered, then you’d also need them to tell you whether they had the minified version or not, which they probably wouldn’t even know. One of the great things about WordPress is it’s very low entry point for new developers. Minifying the code would make it a lot harder for someone to just start hacking on their site. And actually, now many web hosts provide a one-click installer thingy, so many users aren’t even downloading the source to start with.
-J.D.
On Jul 18, 2014, at 4:33 PM, Haluk Karamete <halukkaramete at gmail.com> wrote:
> Commenting is great...
>
> But do you have personal guidelines as to which of the 3 commenting options
> that come with PHP when you comment on SINGLE LINES?
>
> We got 3 to choose from.
>
> #
>
> //
>
> /* */
>
> There must be a reason why we have 3 choices I'm thinking...
>
> And I'm also curious if a leaner version of WordPress (with 0 comments & 0
> unnecessary white space ) has been considered as an optional download for
> those who choose to do so (from the repository) discussed any earlier.
>
> For example, one can choose to download the minified version of 3.9.1 per
> se.
>
> I'm just curious how that discussion went - if any.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list