Giter Site home page Giter Site logo

Link to rationales? about ruby HOT 22 CLOSED

airbnb avatar airbnb commented on June 2, 2024
Link to rationales?

from ruby.

Comments (22)

robotpistol avatar robotpistol commented on June 2, 2024

👍

from ruby.

tommydangerous avatar tommydangerous commented on June 2, 2024

@ljharb I love the rationales.md idea. It is the best of both worlds: concise style guide backed up with rationales. When can we start???

from ruby.

ljharb avatar ljharb commented on June 2, 2024

Immediately :-) PRs welcome! :-p

from ruby.

venantius avatar venantius commented on June 2, 2024

I'm a fan of this, especially if we enable rich linking in the short guide to the specific section in the long guide.

from ruby.

BMorearty avatar BMorearty commented on June 2, 2024

A link to the PR seems like a good, low-cost way to do it. I like that one.

If you do a separate rationales.md, I think it'll be out of sync a lot. I wouldn't recommend a "long version" of the guide that repeats all the guidelines, either--then it will be even more out of sync.

Since these are style issues, a lot of the time there's no rationale other than "we wanted to pick a style so we picked this one." 😜

from ruby.

kevinmsun avatar kevinmsun commented on June 2, 2024

we could always of course add an appendix in the main file, then link down to it from the main rule. rationals.md could also be an incomplete list, just existent for linking, rather than an expanded version of the main style guide

from ruby.

ljharb avatar ljharb commented on June 2, 2024

Even when the rationale is "the N forms are equivalent and we just like this one better" that's hugely valuable - it informs users which rules they don't have to consider too heavily before deviating from in their own projects.

As long as the rationale is immediately reachable, I will be happy. Requiring users to track down the appropriate PR is super hostile to people not intimately familiar with git/github.

imo this guide shouldn't be primarily or solely aimed at rubyists, it should be aimed at non-rubyists who want to use Ruby (especially newcomers to Ruby that work at Airbnb) - and as such, the rationale is pretty critical to understand as readers are learning the language.

from ruby.

tommydangerous avatar tommydangerous commented on June 2, 2024

I see two great ideas, a separate file for the rationales and the appendix that @kmsun07 proposed.

from ruby.

BMorearty avatar BMorearty commented on June 2, 2024

As long as "arbitrary consistency" is a valid rationale. I'm not being flippant or sarcastic. For many--I would say most--style rules, that's the reason. Otherwise I would have a hard time justifying, for example, two-space indentation vs. some other number of spaces.

from ruby.

ljharb avatar ljharb commented on June 2, 2024

Certainly the only reason to choose any number of spaces for indentation is "arbitrary consistency" :trollface: but sure, that's fine to put as the rationale when that applies.

from ruby.

tommydangerous avatar tommydangerous commented on June 2, 2024

Will we go with the separate rationales.md file? Or will we go with the appendix? If I had 1 gummy bear to distribute, I would give it to rationales.md. What is everyone feeling? I can start once we all come to a consensus.

from ruby.

venantius avatar venantius commented on June 2, 2024

I gummy bear rationales.md

I don't think they need to get out of sync - we just make sure people submit PRs that touch both files.

from ruby.

BMorearty avatar BMorearty commented on June 2, 2024

I gummy bear rationales.md

from ruby.

tommydangerous avatar tommydangerous commented on June 2, 2024

I am getting a sugar high! I will start working on it after a couple more gummies.

from ruby.

ljharb avatar ljharb commented on June 2, 2024

gummy bear for rationales.md from me too

from ruby.

tommydangerous avatar tommydangerous commented on June 2, 2024

I'm reading the style guide again and a lot of the rules are already as short as possible with no rationale. The thing that takes up the most space are the examples. Are we wanting to extract the examples into the rationale?

from ruby.

tommydangerous avatar tommydangerous commented on June 2, 2024

Checkout this style guide, my absolute favorite: https://github.com/thoughtbot/guides/tree/master/style/ruby

from ruby.

tommydangerous avatar tommydangerous commented on June 2, 2024

We can do something similar, for example:

Clicking Example will take you to the section in the rationales/examples with:

# bad
def foo
    1
end

# good
def foo
  1
end

from ruby.

venantius avatar venantius commented on June 2, 2024

Personally, I prefer having the example in the main guide because often the wording of the rule itself isn't clear enough for me to immediately understand what the rule is. By contrast, the rationale is truly optional knowledge.

from ruby.

BMorearty avatar BMorearty commented on June 2, 2024

@tommydangerous My initial reaction was "but the examples are so helpful!"

But then I saw your link to the more concise guide at Thoughtbot and I have to say, I love it. It's so easy to scan. I support your suggestion to move the examples out.

from ruby.

tommydangerous avatar tommydangerous commented on June 2, 2024

I will create a PR and we can see how it works.

from ruby.

venantius avatar venantius commented on June 2, 2024

This issue can be closed now, I believe, since rationales.md exists.

from ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.