0

I am always not able to follow Netbeans default coding conventions like the following

Function should be N lines only

Method Length is N Lines (M allowed)

Warning: Do not Access Superglobal $_POST Array Directly

// Using this
$username = filter_input(INPUT_POST, 'username');

// Instead of this
$_POST['username'];

And many more.

It seems really hard to follow all of the coding conventions. So, what can I achieve if I follow it 100 %?

closed as primarily opinion-based by gnat, gbjbaanb, David Arno, user40980, Ixrec Feb 17 '16 at 0:55

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • functions should be N lines max, depends how big N is. The _POST array however, sounds sensible advice - what filter_input does will tell you why. – gbjbaanb Feb 15 '16 at 8:40
  • @gbjbaanb in netbeans the default is 20, so everytime my function passes that limit if warns me. – Cary Bondoc Feb 15 '16 at 8:51
  • 3
    If you do not have your own coding standards in place, then the answer is YES. – BЈовић Feb 15 '16 at 9:15
3

If you do not have your own coding standards in place, then either write it, or adopt one. I do not know what netbeans coding standard is, so I can not say whether it is good or bad.

This answer explains why a coding standard is impotant, and as Uncle Bob said :

  1. After the first few iterations, get the team together to decide.

meaning that you should get a standard, and change it acording to the needs of your team.

Not the answer you're looking for? Browse other questions tagged or ask your own question.