TheHelper / TH-HTML5

TH-HTML5 is a community project opened to anyone (new or old) who has any interest in exploring the aspects of HTML5 and expanding their, as well as others', knowledge towards creating a site employing its new abilities.
http://www.thehelper.net/forums/showthread.php/163657-TH-HTML5-Community-Project
2 stars 0 forks source link

Style Standards #4

Open ghost opened 13 years ago

ghost commented 13 years ago

We need to standardize what way we'll be formatting our code before we continue any further. That way, we don't come across issues with unreadable code.

What needs to be defined:

And anything else you guys can thing of.

sbstp commented 13 years ago

Comment types, Javadoc style or our own?

ghost commented 13 years ago

I think for small project, normal comments (non-javadoc) will be fine, but anything larger than a few dozen or so lines, it probably wouldn't hurt to use javadoc.

Edit: Whoops, I totally closed the issue there for a second. Still getting used to github. :D

sbstp commented 13 years ago

Ok here's what I've got

Javascript: http://javascript.crockford.com/code.html (Thanks phyrex1an), 4 spaces indent, spaces inside of parentheses like this while ( true ) doSomething( a, b, c, d ) HTML: lower case tags, double quotes for attributes, 4 spaces indent.

Just a suggestion...

fkj commented 13 years ago

yeah, that sounds fine with me. What about filename restrictions? Something like [filename][author][version]?

fkj commented 13 years ago

Oh, and a indent between every nest of a tag. Like this:

<body>
    <p>I'm a text!<p>
</body>

This would make eveything so much easier to read.

ghost commented 13 years ago

Indeed. Indentation is very important, as it improves readability. Edit: Damn it, I closed it again. Sorry guys. :/

oskarihiltunen commented 13 years ago

Something like [filename][author][version]?

I say no to that. Having the version in the filename makes sense if you want to use a specific version of something, but otherwise it just makes the URLs non-persistent (which is bad). And in an open source project where anyone can edit anyone's code, 'author' makes little to no sense.

spaces inside of parentheses like this while ( true ) doSomething( a, b, c, d )

Where did you get that from? Can't find it in the conventions you linked, and it's actually the only one I am against. Crockford's conventions seem good to me.

sbstp commented 13 years ago

It's a personnal preference, I guess. It makes reading a big block easier.

You know, sometimes you get like ))) this makes it hard to read sometimes... doSomething(getSomething(18 * (1-20))); doSomething( getSomething( 18 * ( 1 - 20 ) ) );

Just looks better, imo.

fkj commented 13 years ago

I like to do that too.

Also, we should probably not have author names, no.

EDIT: Goddammit.

oskarihiltunen commented 13 years ago

Adding sensible spacing (for example doSomething(getSomething(18 * (1 - 20) ));) might make code easier to read in some cases, but adding spaces inside all parenthesis is like adding none at all in my opinion (except for that it makes the code look stupid).