Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 01-13-2005, 12:43 PM   #1 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
your style?

whats your favorite variable style?

lowercase notation:my_name
cammel notation:myName

or for those who know languages that requiore yuo to define the type of each variable.

hungarian style
falsepride is offline   Reply With Quote
Old 01-13-2005, 12:57 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
you forgot about PascalCase

it really depends on what language i'm coding in. i used to only use one standard, but now it depends on the language i use. i try to conform to the standards of that language.

for example, on php.net, you will always see them using lowercase: $my_name

in java, you will see variable names in cammel case, and then Class names in pascal case. example: String myName = "Mike";

this helps tremendously when more than one person might be working on a project, or if you are modifying an existing application, or someone might modify your program in the future.
__________________
Mike
sde is offline   Reply With Quote
Old 01-13-2005, 02:19 PM   #3 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
what is pascal case?
falsepride is offline   Reply With Quote
Old 01-13-2005, 04:58 PM   #4 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,166
Belisarius is on a distinguished road
If I don't know the accepted standard for a language, or at least can't guess it, I'll lapse into Java style just because it's the one I'm most comfortable with. Otherwise I try to stick to the language standard.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 01-13-2005, 05:25 PM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
Quote:
Originally Posted by falsepride
what is pascal case?
First letter of each word upper case ( even the first word )
__________________
Mike
sde is offline   Reply With Quote
Old 01-13-2005, 06:58 PM   #6 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
Big willie style..

oh. I'm with sde on this. I seem to lapse into different styles depending on the language. I've never been a big fan of pascal, camel [studly] caps, but seem to use them much more with PHP Classes. Although the vars inside the class will be $my_var. Public methods will be: myFunction() and private methods: _myFunction(). (in php4 .. haven't done anything in 5 yet)

I pretty much stick to $my_var and my_cool_function() in perl.

-r
idx is offline   Reply With Quote
Old 01-15-2005, 03:32 AM   #7 (permalink)
Kernel_Killer
Regular Contributor
 
Kernel_Killer's Avatar
 
Join Date: Feb 2003
Location: indisclosed
Posts: 210
Kernel_Killer is on a distinguished road
I have to go for the "no one else will read my code easy except me" style. All lowercase, random characters, and have the 2nd or 3rd letter/number represent if it's a enum, array, local variable, etc,etc.
__________________
Network Synapse
Screaming Electron
Kernel_Killer is offline   Reply With Quote
Old 01-16-2005, 09:40 AM   #8 (permalink)
ender
Code Monkey
 
ender's Avatar
 
Join Date: Mar 2003
Location: Evansville, IN
Posts: 75
ender is on a distinguished road
Send a message via AIM to ender Send a message via Yahoo to ender
I like mixedCase for variable names, with MixedCase for class and function names. This is just personal preference though. If I am working on a project with someone else, I'll obviously conform to whatever style they have for themselves. I have never liked function_name() stuff. I don't know why. Just my $.02.
__________________
while(1) fork();
ender is offline   Reply With Quote
Old 01-27-2005, 07:51 AM   #9 (permalink)
Admin
$_['Your_Mom'];
 
Admin's Avatar
 
Join Date: May 2002
Location: Santee
Posts: 627
Admin is on a distinguished road
i like fooBar() style.
__________________


Urban Clothing
Admin is offline   Reply With Quote
Old 01-27-2005, 08:45 AM   #10 (permalink)
fp_unit
mike
 
Join Date: Jan 2005
Location: Ottawa, ON
Posts: 79
fp_unit is on a distinguished road
I tend to switch it up with the language. If I'm doing Windows programming I tend to use czSomeString type style (hungarian I think) but I mostly stick with ThisIsAClass, someFunctionName and someVariableName. THIS_WOULD_BE_A_CONST but I try to stay away from a_variable and a_function unless I'm doing PHP or something (I basically code in C++, PHP and sometimes Java).
fp_unit is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delphi Phaedrus All Other Coding Languages 21 10-25-2004 06:08 PM
Naming Conventions and Hungarian Notation RobertStout Standard C, C++ 2 10-17-2004 11:32 AM
OpenGL.dll Mr.Anderson Platform/API C++ 3 08-13-2004 10:07 AM
CCS / Style issue sharmap HTML, XML, Javascript, AJAX 6 06-18-2004 08:03 AM


All times are GMT -8. The time now is 03:00 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting