Alex Rivera | Logout

Good name for a list variable in java

Asked 2012-06-12T12:29:33.020
31

What of the following is used popularly or is the standard :

private List<String> names ;

OR

private List<String> listOfNames ;

OR

private List<String> namesList ;
Edit
Report

1 Answer

10

Once upon a time we had Hungarian notation, because IDEs didn't provide intellisense and programmers were too dumb to realise that having a 30,000 line long block of code was unreadable*. Nowadays IDEs are friendly, programmers have started using small, neat classes, we have JavaDoc and things in genral are easier to read.

So, just name your variable for its usage. i.e. names. I'm no fan of pre/post-fixing variables as it often makes them harder to understand.

(*) i.e. Me, there's probably some deeply shameful code out there with my name on it.

answered 2012-06-12T12:35:12.663

Your Answer