librelist archives

« back to archive

Coding Conventions

Coding Conventions

From:
William Bowers
Date:
2012-09-21 @ 02:46
Some discussion about conventions took place before the mailing list was
created. This document -- http://nodeguide.com/style.html -- was put forth
as a possible guide for what our conventions should be. How does everyone
feel about that? Any other suggestions or editions? As for me, I'd prefer
tabs over spaces. If the consensus is for spaces, then I'd prefer 4 spaces
over 2.

When we choose something, I'll put it up on the wiki and pick a couple
files and make sure they adhere.

-- 
-William

Re: [browserquest] Coding Conventions

From:
Justin Clift
Date:
2012-09-21 @ 06:17
On 21/09/2012, at 12:46 PM, William Bowers wrote:
> Some discussion about conventions took place before the mailing list was
created. This document -- http://nodeguide.com/style.html -- was put forth
as a possible guide for what our conventions should be. How does everyone 
feel about that? Any other suggestions or editions? As for me, I'd prefer 
tabs over spaces. If the consensus is for spaces, then I'd prefer 4 spaces
over 2.
> 
> When we choose something, I'll put it up on the wiki and pick a couple 
files and make sure they adhere.

I'm ok with most of the linked style guide.  For me, tabs
kill me nowdays (I reckon they screw up source files), so
I'd really like spaces not tabs there.

For the "if space, 2 or 4?", I don't have a preference.
We just have to be consistent.

So, let's compromise and go spaces, at 4 chars? :)

With that proposed style guide, the stand out thing that
worries me is functions limited to 10 lines.  Conceptually
I wonder how the guy achieves that.  I certainly don't in
non Node.js stuff.

If performance critical code in Node.js needs unrolling
and as little nesting as possible, we'd might need to be
flexible with that particular style guideline.

I didn't mentally absorb all of the referenced style
guide's points up front, as I'm personally more of a
"learn on the fly while doing stuff" type of person.

So, if you want to put the code conventions up on the wiki
now, go for it.  I'll learn them as I go along. ;)

Regards and best wishes,

Justin Clift

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Coding Conventions

From:
William Bowers
Date:
2012-09-21 @ 06:56
> So, let's compromise and go spaces, at 4 chars? :)

Works for me! What do you think, Brynn?

> With that proposed style guide, the stand out thing that worries me is
functions limited to 10 lines.  Conceptually I wonder how the guy achieves
that.  I certainly don't in non Node.js stuff.

Yea, agreed. That convention seems really arbitrary. As a principal small
functions are generally better, but we don't need to be explicit about it.

I also don't think that every conditional and return statement needs to be
put into a variable like the guide does. Thoughts?

> I didn't mentally absorb all of the referenced style guide's points up
front, as I'm personally more of a "learn on the fly while doing stuff"
type of person.

Why don't we do this: start with our modified version of these guidelines
with the caveat that if they don't work, we'll change them with a 2/3rds
vote?

> So, if you want to put the code conventions up on the wiki now, go for it.

Yep! I'll get that up once we get confirmation from Brynn on what he thinks.

Re: [browserquest] Coding Conventions

From:
Brynn
Date:
2012-09-21 @ 06:59
I'll leave conventions up to you guys since you'll be doing actual
development sooner than I, probably. All sounds good to me.
On Sep 20, 2012 11:56 PM, "William Bowers" <william.bowers@gmail.com> wrote:

> > So, let's compromise and go spaces, at 4 chars? :)
>
> Works for me! What do you think, Brynn?
>
> > With that proposed style guide, the stand out thing that worries me is
> functions limited to 10 lines.  Conceptually I wonder how the guy
> achieves that.  I certainly don't in non Node.js stuff.
>
> Yea, agreed. That convention seems really arbitrary. As a principal small
> functions are generally better, but we don't need to be explicit about it.
>
> I also don't think that every conditional and return statement needs to be
> put into a variable like the guide does. Thoughts?
>
> > I didn't mentally absorb all of the referenced style guide's points up
> front, as I'm personally more of a "learn on the fly while doing stuff"
> type of person.
>
> Why don't we do this: start with our modified version of these guidelines
> with the caveat that if they don't work, we'll change them with a 2/3rds
> vote?
>
> > So, if you want to put the code conventions up on the wiki now, go for
> it.
>
> Yep! I'll get that up once we get confirmation from Brynn on what he
> thinks.
>

Re: [browserquest] Coding Conventions

From:
William Bowers
Date:
2012-09-21 @ 07:03
Great! I'll get the conventions up on the wiki soon.

On Thu, Sep 20, 2012 at 11:59 PM, Brynn <brynnbateman@gmail.com> wrote:

> I'll leave conventions up to you guys since you'll be doing actual
> development sooner than I, probably. All sounds good to me.
> On Sep 20, 2012 11:56 PM, "William Bowers" <william.bowers@gmail.com>
> wrote:
>
>> > So, let's compromise and go spaces, at 4 chars? :)
>>
>> Works for me! What do you think, Brynn?
>>
>> > With that proposed style guide, the stand out thing that worries me is
>> functions limited to 10 lines.  Conceptually I wonder how the guy
>> achieves that.  I certainly don't in non Node.js stuff.
>>
>> Yea, agreed. That convention seems really arbitrary. As a principal small
>> functions are generally better, but we don't need to be explicit about it.
>>
>> I also don't think that every conditional and return statement needs to
>> be put into a variable like the guide does. Thoughts?
>>
>> > I didn't mentally absorb all of the referenced style guide's points up
>> front, as I'm personally more of a "learn on the fly while doing stuff"
>> type of person.
>>
>> Why don't we do this: start with our modified version of these guidelines
>> with the caveat that if they don't work, we'll change them with a 2/3rds
>> vote?
>>
>> > So, if you want to put the code conventions up on the wiki now, go for
>> it.
>>
>> Yep! I'll get that up once we get confirmation from Brynn on what he
>> thinks.
>>
>


-- 
-William

Re: [browserquest] Coding Conventions

From:
William Bowers
Date:
2012-09-21 @ 07:24
The Coding Conventions page is up. Let me know what you guys think:
https://github.com/browserquest/BrowserQuest/wiki/Coding-conventions

Re: [browserquest] Coding Conventions

From:
Justin Clift
Date:
2012-09-21 @ 07:37
On 21/09/2012, at 5:24 PM, William Bowers wrote:
> The Coding Conventions page is up. Let me know what you guys think: 
https://github.com/browserquest/BrowserQuest/wiki/Coding-conventions 

Excellent, looks good. :)

Any idea if we can can use git precommit hooks to catch some of this
stuff?

+ Justin

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Coding Conventions

From:
William Bowers
Date:
2012-09-21 @ 07:49
I think our best bet for this would be jslint. This is definitely something
worth looking into.

On Fri, Sep 21, 2012 at 12:37 AM, Justin Clift <jclift@redhat.com> wrote:

> On 21/09/2012, at 5:24 PM, William Bowers wrote:
> > The Coding Conventions page is up. Let me know what you guys think:
> https://github.com/browserquest/BrowserQuest/wiki/Coding-conventions
>
> Excellent, looks good. :)
>
> Any idea if we can can use git precommit hooks to catch some of this
> stuff?
>
> + Justin
>
> --
> Aeolus Community Manager
> http://www.aeolusproject.org
>
>


-- 
-William

Re: [browserquest] Coding Conventions

From:
Justin Clift
Date:
2012-09-24 @ 07:50
On 21/09/2012, at 5:37 PM, Justin Clift wrote:
> On 21/09/2012, at 5:24 PM, William Bowers wrote:
>> The Coding Conventions page is up. Let me know what you guys think: 
https://github.com/browserquest/BrowserQuest/wiki/Coding-conventions

Just noticed the existing BQ source uses variables_names_like_this,
instead of lower camel case (as per Felix's Style Guide).

Are you ok with updating our Coding Conventions page to reflect
underscore joined variable names?

+ Justin

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Coding Conventions

From:
Brynn
Date:
2012-09-24 @ 07:58
I've mostly only seen camel case on the server side of things, which is
what I prefer.
On Sep 24, 2012 12:50 AM, "Justin Clift" <jclift@redhat.com> wrote:

> On 21/09/2012, at 5:37 PM, Justin Clift wrote:
> > On 21/09/2012, at 5:24 PM, William Bowers wrote:
> >> The Coding Conventions page is up. Let me know what you guys think:
> https://github.com/browserquest/BrowserQuest/wiki/Coding-conventions
>
> Just noticed the existing BQ source uses variables_names_like_this,
> instead of lower camel case (as per Felix's Style Guide).
>
> Are you ok with updating our Coding Conventions page to reflect
> underscore joined variable names?
>
> + Justin
>
> --
> Aeolus Community Manager
> http://www.aeolusproject.org
>
>

Re: [browserquest] Coding Conventions

From:
Justin Clift
Date:
2012-09-24 @ 08:01
On 24/09/2012, at 5:58 PM, Brynn wrote:
> I've mostly only seen camel case on the server side of things, which is 
what I prefer.

Ahhhh, ok.  It must have just been the files I was looking at (ws.js and
main.js mostly).

No worries then.  We'll probably need to do a bit of clean up and get
everything consistent. :)

+ Justin

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Coding Conventions

From:
William Bowers
Date:
2012-09-24 @ 15:14
I've only ever seen lower camelcase in JavaScript. I'd prefer that as well.

Re: [browserquest] Coding Conventions

From:
Justin Clift
Date:
2012-09-24 @ 15:18
On 25/09/2012, at 1:14 AM, William Bowers wrote:
> I've only ever seen lower camelcase in JavaScript. I'd prefer that as well.

It's no worries, I just thought we'd missed something.  But no. :)

+ Justin

--
Aeolus Community Manager
http://www.aeolusproject.org