[Phpmyadmin-devel] Maximum length of variable names
Michal Čihař
michal at cihar.com
Mon Jan 6 11:38:26 CET 2014
Hi
Dne Sun, 05 Jan 2014 09:36:10 -0500
Marc Delisle <marc at infomarc.info> napsal(a):
> I'm aware that I'm opening a can of worms, but can we discuss PHPMD rules?
I think those were never actually discussed, we just run then in
Jenkins. So I think it's good idea to discuss coding style beyond
indentation and whitespaces.
> In particular, I find that to obey the maximum variable name (20
> characters) rule, one has to sometimes abbreviate at the expanse of clarity.
I think this is quite connected to line length as well. In case you
have longer variable names and stick with current line length, the code
will be a bit harder to read due to necessary wrapping, for example:
https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/browse_foreigners.lib.php#L152
Looking at current long variable names, I see following patterns:
- pma prefix, is that really needed? [1]
- return values from function called $something_somewhere_html, using
just $result might be even better to understand in this context [2]
- some variables still being used as globals, thus needing to provide
too much context in their names [3]
- some probably legitimate usages of long name [4]
[1]:https://github.com/phpmyadmin/phpmyadmin/blob/master/view_create.php#L95
[2]:https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/DisplayResults.class.php#L5203
[3]:https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/mysql_charsets.inc.php#L17
[4]:https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/DisplayResults.class.php#L2779
--
Michal Čihař | http://cihar.com | http://phpmyadmin.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20140106/149270d9/attachment.sig>
More information about the Developers
mailing list