string - Java: variable names for a directory path, naming variables in general -


i'm having difficulties decide how name file variable , string variable, both describe same directory.

basically have string describing location of directory containing testcases. string want create file object. this:

string testcasedirectorypathstring; file testcasedirectorypath = new file(testcasedirectorypathstring); 

what want achieve readability code, choosing variable names.

i searched internet, end finding naming conventions in general , advice variable names should 'speaking'.

my question specific examples, problem not string , file naming choosing variable names in general.

so here questions:

  1. is practice add word 'string' string object?

  2. is practice add word 'path' file object?

  3. is matter of personal preference , there no practices?

  4. how name variabls , why?

if there articles out there, appreciate pointing me them.

it's opinion:

  1. is practice add word 'string' string object?

no, doesn't contribute. make name longer without reason adding type in name.

  1. is practice add word 'path' file object?

same nÂș1. don't need type in name of variable.

  1. is matter of personal preference , there no practices?

always need follow practice coding make legible, have in mind:

“always code if guy ends maintaining code violent psychopath knows live.” - john f. woods.

and important thing, try allways follow company naming standards, maybe aren't best make code rideable.

  1. how name variabls , why?

i try name variables short names, specifying important , following lower camel case using english working in spanish company not mandatary. , said following company naming standards.

string testcasedirectorypathstring;

file testcasedirectorypath = new file(testcasedirectorypathstring);

if don't have directory path maybe use this:

string directorypath;

file <<something describe result file>> = new file(directorypath);

with <<something describe result file>> means prizerepresentations, annualsales, etc...

off record if use eclipse can see plugins checkstyle , pmd, have clean , clear code , used work way.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -