Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style guide for workshoppers #37

Open
mmwtsn opened this issue May 13, 2015 · 3 comments
Open

Style guide for workshoppers #37

mmwtsn opened this issue May 13, 2015 · 3 comments

Comments

@mmwtsn
Copy link

mmwtsn commented May 13, 2015

Thoughts on adding a suggested style guide for the workshoppers source code?

I have been enjoying going through them but have found the code samples formatting inconsistent. It's not a huge deal but considering that this could be someone's first introduction to Node.js development it would be nice to be able to say "Hey, here's how we recommend you format your code."

Code style could be incorporated as an early lesson in learnyounode. This should be fairly straightforward for the user if an npm-distributed formatter is suggested like Standard.

@martinheidegger
Copy link
Contributor

While generally not a bad thought it is a very religious issue you are trying to kick off here.

@mmwtsn
Copy link
Author

mmwtsn commented May 13, 2015

I'm less interested in a holy war than I am in consistency.

Here's an example solution from expressworks:

var express = require('express')
var app = express()

app.use(require('stylus').middleware(process.argv[3]));
app.use(express.static(process.argv[3]));


app.listen(process.argv[2])

While this is a trivial example the quality of the solution could be improved by running a simple linter over it.

Given how NodeSchool presents itself and its workshoppers it makes sense that they would all be formatted similarly. The Go team summarized quite nicely on their blog where they outline the benefits consistently formatted code:

  • easier to write: never worry about minor formatting concerns while hacking away,
  • easier to read: when all code looks the same you need not mentally convert others' formatting style into something you can understand.
  • easier to maintain: mechanical changes to the source don't cause unrelated changes to the file's formatting; diffs show only the real changes.
  • uncontroversial: never have a debate about spacing or brace position ever again!

Put that way it really isn't terribly controversial. Making a decision at the workshopper level saves individual contributors from having to have these conversations or entertain style-based pull requests.

For what it's worth npm will be using Standard moving forward.

@martinheidegger
Copy link
Contributor

@mmwtsn I have no problem with coding standards. I just wanted to prepare you for the discussion you are bringing yourself into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants