I'm in a C++ class that has put emphasis on understandability (the ability for other users previously unfamiliar with your code to be able to decipher and edit your code).
Additionally, we were instructed that long variable names can be confusing and should be avoided as well.
My question is, are my variable names too long??
I've got to name three separate variables that are all years.
They are all in different centuries, thus I have them named:
Grant it, I could use the "downhill effect" of C++ coding to my advantage, and justCode:int seventeenth_century_year, eighteenth_century_year, nineteenth_century_year;
make the int named year and re-establish its value further down the code as needed because nowhere in the code would 2 different year values needed to be calculated together. e.g.
Note that there is no user input in this program, so the variable value cannot be manipulated that way.Code:int year, var2 year = 1700 var2 = sqrt(year) //outputs //outputs //outputs year = 1800 var2 = sqrt(year) //outputs //outputs //outputs year = 1900 var2 = sqrt(year) //outputs //outputs //outputs
(This is a school assignment for an intro C++ class, and the overall goal is to improve our development of algorithms pre-coding.... Not so much to improve our ability to code)
Thanks in advance!



LinkBack URL
About LinkBacks


