Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

naming conventions

Name: Anonymous 2007-05-19 22:21 ID:Hhy+e3mf

What's /prog/'s preferred naming convention for C-like languages? Personally I find CamelCase easier to type, but under_score easier to read.

Name: Anonymous 2007-05-19 22:25 ID:jpbjW/br

under_score

Name: Anonymous 2007-05-19 22:45 ID:Heaven

single lowercase letters.
unless you're writing a library, then it's under_score or GTFO. or i'll just use the amazing power of #define to make your shit readable...

Name: Anonymous 2007-05-19 23:15 ID:p5aixpRU

shitCase

Name: Anonymous 2007-05-20 0:08 ID:3D28or/p

Basically CamelCase, with a few extra rules:
1. First letter is only capitalized on classes.
2. Acronyms are fully capitalized if the first letter normally would be; thus HTMLParser rather than HtmlParser for a class, and htmlToXHTML rather than HTMLToXHTML for a function.
3. Constants (or variables which are used as such in languages without support for constants) are all uppercase with underscores separating words, and usually have a prefix for ones which are used for the same things; for example, COLOR_GREEN and COLOR_RED
4. ???
5. PROFIT!

Name: Anonymous 2007-05-20 0:23 ID:Heaven

>>4,5
Only furries use shitCase.

Name: Anonymous 2007-05-20 0:50 ID:mOzweMSY

>>6
At least with shitCase you have a reliable measurement of how Enterprise your code is. If you hit shift half a dozen times when typing variable names your shit is well on its way to being Enterprise quality.

Name: Anonymous 2007-05-20 1:12 ID:Heaven

>>7
Yeah, but is becoming a furry really worth that?

Name: Anonymous 2007-05-20 1:33 ID:pRuOBKDZ

In C, I use words_separated_with_underscores, both in function and variable names. #define-d things are CAPITALIZED.

In C++, Java and C#, class names are SeparatedWithCapitals. C++ method names with underscores, java method names inDromedaryCase, C# method names like class names. These follow the conventions of the languages' respective standard libraries.

Haskell, which is completely different, gets isDromedaryCase and whatever'' and "foo:foos". More conventions than you could shake a stick at.

Name: Anonymous 2007-05-20 2:51 ID:occE31GR

I've always used shitCase, but ever since I started doing more C shit recently, I find myself using underscores more.

Name: Anonymous 2007-05-20 3:26 ID:T2jka9b0

camelCase looks like this int CAMEL CAMEL = ten;

Name: Anonymous 2007-05-20 4:31 ID:AFVJpLKX

camelCase, pretty much the same as >>5 when working with Java. When working with C or perl i use under_scores for functions and variables.

Name: Anonymous 2007-05-20 5:24 ID:OBPZStZz

I always use the style of the standard library of the language in question (with the exception of C, obviously, where I just use underscores).

Name: Anonymous 2007-05-20 8:12 ID:17AqObDG

ClassName
functionName
variableName
CONSTANT

Name: Anonymous 2007-05-20 10:57 ID:RS3ThQA7

>>14
same

Name: Anonymous 2007-05-20 14:11 ID:Pi0CL0iw

DataType

functionName
functionName' (strict version)
functionNameM (monadic version)
functionNameM_ (monadic version that returns m ())

variableName
x - single local variable
xs - list

Name: Anonymous 2007-05-20 16:16 ID:yj1oRhxZ

oo-bar        "-" is used as a word delimiter
*foo*         (global) special variable
foo*          slightly different variant of the foo operator
&foo          lambda list keyword. These symbols will be in the lambda-list-keywords list.
nfoo          (possibly) destructive (non-consing) function
foop          predicate (also foo-p); see notes below for when to hyphenate
foof          place changing (like in SETF, INCF, ...) (also foo-f)
+foo+         constant, or single CLOS instance
%foo          low-level, fast, dangerous function, or Lisp system specific implementation of foo
make-foo      create a foo and return it
define-foo    (globally) define a new foo (also short version: "deffoo")
with-foo      create a dynamic context with a foo
do-foo        iterate through a foo
foo-case      foo-specific case expression
foo-bar       type-slot, converting FOO to BAR
foo-to-bar    converting FOO to BAR


thread over.

Name: Anonymous 2007-05-21 2:41 ID:4CnUQKN0

>>16
I don't get why people insist on naming strict versions with the prime. The bit where you want the compiler to be strict for you (ooh, BDSM-tastic!) aside, prime ought to mean that the thingy that was prime'd is substantially different from the one without the prime... like it had a different type or different edge cases or something.

Give me back my "sfoldl" is what I mean, dammit!

Name: Anonymous 2007-05-21 3:46 ID:hEosEiGx

I wish more programming languages supported Unicode.

ﷺ is the ultimate metasyntactic variable.

Name: Anonymous 2007-05-21 4:03 ID:J0SprHEB

I use one true convention:

DEFINE_CONSTANT
ClassName
MethodName
FunctionName
variable_name (arguments, important variables)
i, j, k (loop variables, temporary variables)

Also, braces are like:

for (;;) {
    //True braces convention
}


P.S.: shitCase looks fugly and sucks big time.

Name: Anonymous 2007-05-21 4:11 ID:RFWzXHqK

>>20
No.

#define DEFINE_CONSTANT bla
class ClassName() {
    int variableName;
    void functionName() {
        for (int i; i<5; i++) {
            //the only programming style
        }
    }
}

K&R style, without the gay ass "class declaration open brace compensating for compiler shortcomings" bullshit.

Name: Anonymous 2007-05-21 4:42 ID:Heaven

>>20
GTFO C# fag

Name: Anonymous 2007-05-21 15:05 ID:YTLrQAmK

CONSTANT
functionName
methodName
m_classAttributeName
variableName
ClassName

FFS

Name: Anonymous 2007-05-21 15:22 ID:Heaven

>>23
m_classAttributeName

Kill yourself.

Name: Anonymous 2007-05-21 16:29 ID:rYed46k/

>>21
Argh shitCase is shitty! Don't use shitCase. Plus shitCase considered dangerous: it can't be told from lowercase if the name has only one word. Stupid, ambiguous. Shitty. Hence shitCase. Only Javafags and the like are meant to use it.

>>23
Why the fuck do you mongle your properties? Also shitCase, see above.

All of you OOfags need to stop doing what Javafags do. Consider that Javafags are inherently stupid, therefore their practices not only are not good, but they are probably bad.

Name: Anonymous 2007-05-21 17:22 ID:Heaven

>>25
it can't be told from lowercase if the name has only one word.
That's a feature, dumbass.

Name: Anonymous 2007-05-21 18:34 ID:H++qK6Vv

functionname
classname
variablename

Name: Anonymous 2007-05-21 19:13 ID:8DejbGrT

>>25
You haven't listed a single reason why "shitCase" is bad, except this pathetic "U CNT TELL IT FROM LOWERCAES IF U ONLY HAEV ONE WURD!!1" What the fuck? Do words disappear off your screen if at least one letter isn't capitalized? Are you having trouble reading my post because some of the letters are lowercase?

Grow a nutbeard. Then you can come talk to the big people.

Name: Anonymous 2007-05-21 19:58 ID:2P5jPwqO

>>28
Actually, they might just disappear if the code's a total mess and you're editing it with some shit editor that can't do syntax highlighting.

Name: Anonymous 2007-05-21 21:39 ID:Heaven

Emacs has a mode that automatically converts between the two styles. Problem solved.

Name: Anonymous 2007-05-21 21:46 ID:U/O3Xu2j

>>27
This

Name: Anonymous 2007-05-22 2:15 ID:USZsWiKr

>>29
That's a problem with the programmer, not the naming style.

Grow a nutbeard.

Name: Anonymous 2007-05-22 2:51 ID:3Y0wTIqc

non-breaking spaces should be part of the variables. MUAHAHHAE13,1pm31lisp())()()()(

Name: Anonymous 2007-05-22 15:52 ID:g0bwqPsu

hybrid shitCase for javascript, to use C conventions where possible but maintain consistency with the DOM:
ClassName
functionName
variable_name
CONSTANT_NAME

Name: Anonymous 2007-05-22 16:22 ID:IoV5Gxh2

>>26
That's a bug, dumbass. A property is a property, and a method is a method. You want to tell the two apart. You can't if you use shitcase. Don't come saying verbs vs nouns and all that OOfag bullshit because in real scenarios you just need more words and/or make everything overly verbose (a common OOfag trait).

>>28
shitCase is ambiguous. You use casing to distinguish between different types of symbols. If shitCase looks like lowercase, then it loses its purpose. Why the fuck do you even bother with casing and style and get trolled so hard if shitCase fails to serve its purpose?

Name: Anonymous 2007-05-22 16:23 ID:IoV5Gxh2

>>34
The DOM is nasty, and you want to use its "style"? Enjoy your getElementById.

Name: Anonymous 2007-05-22 20:35 ID:3FDdQ1y0

>>24
What's wrong with it ?

Name: Anonymous 2007-05-22 21:19 ID:9iAwqA+Q

Naming conventions are for wimps, just look at where the supid thing is declared.

Name: Anonymous 2007-05-23 1:48 ID:G029ra1h

>>27
removepropertychangelistener(propertychangelistener listener)

nah, it just becomes a bunch of letters.

Name: Anonymous 2007-05-23 5:19 ID:gLNT40XX

It's called Hungarian Notation.
Look it up
Use it
Live it

Name: Anonymous 2007-05-23 5:33 ID:coKpcZ0G

>>37
1. It's stupid. If you can't tell the type of a variably by its name, you clearly need a better name.
2. It's fugly to read and type. lpszFuckMyAss.
3. It's unmaintainable. What happens when you change a variable's type or class, or a class name? It's not like your design is so limited that it can't be reused in a slightly different way, right?

Name: Anonymous 2007-05-23 5:36 ID:g9QjR1tO

>>40
>>41

"real" hungarian shows the intention for the use of the variable, not the type, which is microsoft's bastardization

Name: Anonymous 2007-05-23 6:48 ID:VWmtKPdG

"real" hungarian shows the intention for the use of the variable, not the type, which is microsoft's bastardization

Actually 'real' hungarian was invented inside MS too. It was invented in the apps department and then totally misunderstood by the OS department. I'm assuming you've read that Joel Spolsky essay too; you just don't remember it very well :P

Name: Anonymous 2007-05-23 8:24 ID:coKpcZ0G

>>42
I suppose the same kind of object would then receive different Hungarian prefixes. If so, then you don't even need Hungarian notation because the prefix will do. I just don't see how Hungarian notation wouldn't be a messy piece of shit to make code ugly and discourage small developers.

Name: Anonymous 2007-05-23 12:47 ID:qm9Vo2GC

In assembler I never used labels, but absolute addresses.  I continue the tradition today, by just using numbers for names, i.e. v00000000, v00000001, v00000002, etc.  I use this notation for every variable name and label.  I also use goto, never use function calls, and make extensive use of global variables, because using the stack is a security risk.

Name: Anonymous 2007-05-23 13:04 ID:GIBSd/k3

>>45
i love you

Name: Anonymous 2007-05-23 13:08 ID:Y7ZGEIXa

Name: Anonymous 2007-05-23 13:31 ID:GIBSd/k3

>>47
You don't need to post link
Everyone knows Mel

Name: Anonymous 2007-05-23 15:50 ID:igQ6duVc

Mel's awesome

Name: Anonymous 2007-05-23 16:09 ID:ayOsFBND

Hehe, I wrote some machine code today.  Just a one-byte crack though, changing a JE to a JMP.

Name: Anonymous 2007-05-23 17:47 ID:3WsgGeDt

I did that once. It was awesome, I felt so HARDCORE.

Name: Anonymous 2007-05-23 22:27 ID:his2IaIv

BRIAN THOUGHT HE WAS TOTALLY HACKING THE GIBSON BUT ENDED UP FORMATTING HIS HARD DRIVE INSTEAD

Name: Anonymous 2007-05-24 4:36 ID:Lh9LFdrh

SANDCOAR

Name: Anonymous 2009-01-14 13:29

No

Name: Anonymous 2009-01-14 13:34

>>40
>>40
loooooooooooooool

Name: Sgt.Kabu宠kiman๮硂 2012-05-29 2:14

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List