Gossamer Forum
Home : General : Chit Chat :

Academia, Naming conventions for programming languages

Quote Reply
Academia, Naming conventions for programming languages
Ok, I just have to vent my frustration on this stuff. I thought I'd post here instead of the Perl forum as it's really not a programming question per say.

I was in my C++ data structures lecture today and my instructor was telling us that he was changing his style of naming variables to a new way he had been seeing in various texts. He proposed the following:

int myVarName;

I know that some people have probably used this before, but I think it's just a dumb way to decare something. Mixes cases just makes it look messy in my opinion.

I tend to use this style as it seems alot more readable:

int my_var_name;

And uppercase like this for globals:
int MY_VAR_NAME;

I don't know, what does everyone else think. I know I'm kind of making alot of something so trivial but we have to follow is style of coding in the class so it's going to be very awkward to say the least.

Later,
Paul
http://www.fullmoonshining.com for Pearl Jam Fans
Quote Reply
Re: [haplo] Academia, Naming conventions for programming languages In reply to
Different languages have their own recommendations for how variables should be named. The way your teacher mentioned, is the commonly accepted Java way. Perl has it's own (see the style guide..it's at perl.com somewhere, too lazy to go look right now)
Quote Reply
Re: Academia, Naming conventions for programming languages In reply to
apparently there are 2 camps on that issue to use _ or CAPS

almost like a mini M$ vs Apple situation though!

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [Mark Badolato] Academia, Naming conventions for programming languages In reply to
Thanks, yeah, I know different languages have different ways but the way I mentioned just seems kind of a weird way of doing things. Anyway, I've seen that Perl style guide before in Programming Perl I believe. The one in Programming Perl that I'm thinking about is the style that Larry Wall recommends.

It recommends using underscores to seperate words in variables, yeah, that is my proferred style. It also says to use all caps for constants, capitalize each word if it is package-wide global and all lower case for my or local variables.

Later,
Paul
http://www.fullmoonshining.com for Pearl Jam Fans
Quote Reply
Re: [haplo] Academia, Naming conventions for programming languages In reply to
PHP's standard is myVarName for functions, I can't remember if there is a standard for naming scalars.
Cheers,
Michael Bray